Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0][com_fields] Fix draggable sorting #30094

Merged
merged 2 commits into from
Jul 15, 2020
Merged

Conversation

Quy
Copy link
Contributor

@Quy Quy commented Jul 13, 2020

Closes #30073.

Summary of Changes

Fix draggable sorting

Testing Instructions

Go to Content > Fields
Create fields
Click Ordering header
Drag rows to sort
Create field groups
Click Ordering header
Drag rows to sort
Assign fields to field groups
Drag rows to sort within field groups

Actual result BEFORE applying this Pull Request

Sortable in last position only

Expected result AFTER applying this Pull Request

Sortable in any positions

@ceford
Copy link
Contributor

ceford commented Jul 14, 2020

I have tested this item 🔴 unsuccessfully on b44e874

Can sort within field group but the sorting behaviour is still not as required. I have 5 fields, 1 not in a group, 1 and 3 in named groups. The individual items I can only drag to the bottom of the list. I believe I should be able to sort the individual items irrespective of their groups.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30094.

@Quy
Copy link
Contributor Author

Quy commented Jul 14, 2020

Is sorting an issue with Fields only or with other components too?

@Quy
Copy link
Contributor Author

Quy commented Jul 14, 2020

Can you provide a screenshot of the fields so I can see what you are trying to do?

@ceford
Copy link
Contributor

ceford commented Jul 14, 2020

Here is a case where I have ordered fields crossing groups but I can only do it by dragging down.
image
I assumed that selecting order despite group is the expected behaviour.

@Quy
Copy link
Contributor Author

Quy commented Jul 14, 2020

For the first field, there are no other fields without a field group assigned to sort against.
Yes, it allows you to sort by dragging to the bottom, but essentially, it is still the same position.

For the More Info group, you can sort fields within this group without dragging to the bottom.

Click on the Filter Options.
Filter on Flower data group.
There is only one entry so no sorting possible.
Basically, this is the same scenario with Latin name field.

@ceford
Copy link
Contributor

ceford commented Jul 14, 2020

The sort order in the fields list affects the display order in the front end. Examples before and after changing order:
image

image

@Quy
Copy link
Contributor Author

Quy commented Jul 14, 2020

It could be related to this issue #23905. This PR fixes the dragging to the bottom only.

@Quy
Copy link
Contributor Author

Quy commented Jul 14, 2020

Is the latest screenshot a result of this PR?

@ceford
Copy link
Contributor

ceford commented Jul 14, 2020

No - the screenshots were without the patch. But with the patch it makes no difference - I can drag anything to the bottom of the list but only a group member upwards to within its group.

@brianteeman
Copy link
Contributor

I would not expect to be able to sort into a group. Just as you can not sort into a category etc

@ceford
Copy link
Contributor

ceford commented Jul 14, 2020

I would not expect to be able to sort into a group. Just as you can not sort into a category etc

But articles, users and contacts don't offer sorting by category!

@brianteeman
Copy link
Contributor

oh yes they do

keyb

@ceford
Copy link
Contributor

ceford commented Jul 15, 2020

I am still baffled! With the patch applied, referring to my illustration above, I can drag any member of the More Info group up or down within its group. I can drag any field to the bottom of the list as illustrated. If I drag the ungrouped item or the Flower data group item to the bottom of the list I can't drag it up again. Is this the desired behaviour? Or even desirable behaviour?

I am revising the Help screens for Fields and Field Groups so I really need to understand it all myself. As I see it, the Field Group order just controls the Tab order in the data entry form and has no effect in the front end. The Field order affects the order within the data entry tab and the display order in the front end. Is that right?

@ceford
Copy link
Contributor

ceford commented Jul 15, 2020

By way of illustration, I just removed the patch and decided to put the Fields in the correct order. I had to move each one individually to the bottom of the list. Not too tedious with 5, but imagine doing it with 10 or 20 and making a mistake.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30094.

@brianteeman
Copy link
Contributor

As I see it, the Field Group order just controls the Tab order in the data entry form and has no effect in the front end.

No. It also controls the order in the front end

The Field order affects the order within the data entry tab and the display order in the front end.

Yes

@ceford
Copy link
Contributor

ceford commented Jul 15, 2020

As I see it, the Field Group order just controls the Tab order in the data entry form and has no effect in the front end.

No. It also controls the order in the front end

That seems to be not the case. In a fresh test these are my field groups:

image

And the Latin name field is not in a group so appears in the Fields tab. This is my Fields order:

image

And this is the front end rendering:

image

So the front-end order seems to be controlled only by the Field order.

The Field order affects the order within the data entry tab and the display order in the front end.

Yes

Agree!

@Quy
Copy link
Contributor Author

Quy commented Jul 15, 2020

I had to move each one individually to the bottom of the list. Not too tedious with 5, but imagine doing it with 10 or 20 and making a mistake.

Use Filter Options to select the desired field group to display applicable fields. With this PR, you can drag and drop within the group and not to the bottom only.

In other words, filter the list to exclude fields not relevant to the field group so you don’t have to interact with them.

@ceford
Copy link
Contributor

ceford commented Jul 15, 2020

Use Filter Options to select the desired field group to display applicable fields. With this PR, you can drag and drop within the group and not to the bottom only.

In other words, filter the list to exclude fields not relevant to the field group so you don’t have to interact with them.

That does not make sense. The Select Field Group drop-down list does not contain No Field Group and if I select Flower Data I cannot move it with respect to More Data. So I repeat: the order shown in the Fields list is the order displayed in the front end. We really need to be able to move any field up or down irrespective of field group.

@brianteeman
Copy link
Contributor

We really need to be able to move any field up or down irrespective of field group.

No we dont - that makes no sense and defeats the objective of grouping the fields.

the order shown in the Fields list is the order displayed in the front end.

And that is correct.

With this PR the code is working correctly as designed and exactly how it is working in joomla 3

@brianteeman
Copy link
Contributor

I have tested this item ✅ successfully on 7bc66cc


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30094.

1 similar comment
@bonzani
Copy link

bonzani commented Jul 15, 2020

I have tested this item ✅ successfully on 7bc66cc


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30094.

@ceford
Copy link
Contributor

ceford commented Jul 15, 2020

OK - I rethink my use of Fields and Field Groups to use them as designed, and document accordingly. Sorry for being such a pain!

@Quy Quy added this to the Joomla 4.0 milestone Jul 15, 2020
@Quy Quy merged commit 1c63746 into joomla:4.0-dev Jul 15, 2020
@Quy Quy deleted the 30073-draggable branch July 15, 2020 13:43
dgrammatiko added a commit to dgrammatiko/joomla-cms that referenced this pull request Jul 21, 2020
…outs

* '4.0-dev' of github.com:joomla/joomla-cms: (612 commits)
  [4.0] Smart Search: Fixing ordering, order direction and disabled button (joomla#29474)
  [4.0] Generate routed Modal links for iframes when not on the root (joomla#30007)
  [4.0] Get menu directly in com_tags menu route helper (joomla#30039)
  Remove collapse when resizing from mobile to desktop (joomla#30132)
  [4.0] Wrap component output in `main` element to make Cassiopeia more accessible (joomla#29870)
  [4.0] Webauthn gmp warning (joomla#29731)
  [4.0] Refactor to return early, remove if depths and throw NotAllowed (joomla#29694)
  [4.0] CLI help text (joomla#29811)
  Feature/draggable typo fixes (joomla#29987)
  [4.0] Removing unnecessary workaround in finder indexer (joomla#30037)
  [4.0] Optimizing Smart Search for larger content (joomla#30008)
  [4.0] Fix js ajax for pre update checker (joomla#29980)
  [4.0] Cassiopea: Fixing modals custom-select fields display (joomla#30097)
  [4.0][com_fields] Fix draggable sorting (joomla#30094)
  [4.0] Correct incorrect @return documentation (joomla#30092)
  [4.0] Menu items modal: adding missing filters (joomla#30087)
  short to long php open tags with echo (joomla#30089)
  Use new Toolbar (joomla#30085)
  [4.0] Center status/date created headers (joomla#29249)
  [4.0] Fix Cassiopea searchtools alignment in modals (joomla#30077)
  ...

# Conflicts:
#	administrator/components/com_templates/src/View/Template/HtmlView.php
#	installation/sql/postgresql/base.sql
#	libraries/src/Application/AdministratorApplication.php
#	libraries/src/Application/SiteApplication.php
sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
* Fix draggable sorting

* Semicolon
@jan-klima
Copy link

Hey guys, I know its old but it still doesnt work properly for me. I am on J4.1.5 and I can only drag all the way down + it doesnt save it. Resets position on reload...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants