I just realized an issue with searchtools. In my custom component, search direction is set to a default value, which results in selected ordering option. Select field example:
<select...>
Title ASC Title DESC Title ASC Title DESCWhen I click on id column, ordering select field gets an additional option entry instead of selecting existing option (issue 1) and previous selected option is still selected (issue 2):
<select...>
Title ASC Title DESC id ASC id DESC id ASC `In my select Model->getListQuery() method "title desc" is set for ordering, no matter which column I selected for ordering.
If I unset default value, behaviour is the same but we got only one selected option, so ordering is done as expected:
<select...>
Title ASC Title DESC id ASC id DESC id ASC `Summary:
Issue 1: Option is added even if exists:
searchtools.js, line 460: if (desiredOption && desiredOption.length) {
desiredOption has no length, so here we always get false and new option will be added.
Issue 2: "old" option is still selected and should be de-selected before form submit
| Labels |
Added:
No Code Attached Yet
|
||
Tested on Joomla 6.1-dev and 5.4-dev using the core Articles component.
Steps:
Result:
No duplicate options were created and only one option remained selected.
Console inspection of
list[fullordering]options also shows no duplicated values.It may be that this behaviour only occurs in certain custom components or configurations, as I could not reproduce it using the core Articles list view.