J4 Issue ?
avatar skurvish
skurvish
6 Feb 2021

Steps to reproduce the issue

Have an admin from that does not have fullordering select list

Expected result

Clear button should clear the search field and reload the list of items

Actual result

Nothing.

System information (as much as possible)

Tested on current J4 git.

Additional comments

If your admin form is using LayoutHelper::render('joomla.searchtools.default', array('view'=>$this)) in your view and your form does not have a select list named fullorderering the clear button onClick event gets cleared. This event is added in searchtools.js at line 175.

Further on at line 179 a call to function createOrderField is made. Within this function at line 440 a test is made to determine if this select list was found. If it was not found it is created.

The problem happens due to line 447 where the new orderField is appended to the form. The execution of this statement

      this.theForm.innerHTML += this.orderField.outerHTML;

Causes the attached onClick of the Clear button to be dropped.

In the J3 version of this searchtools.js file the orderField is attached using the jQuery append which I gather does not cause this issue but I have not tested it.

avatar skurvish skurvish - open - 6 Feb 2021
avatar joomla-cms-bot joomla-cms-bot - change - 6 Feb 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 Feb 2021
avatar richard67 richard67 - change - 6 Feb 2021
Build staging 4.0-dev
avatar richard67 richard67 - change - 6 Feb 2021
Title
Seachtools.js is dropping clear button event
[4.0] Seachtools.js is dropping clear button event
avatar richard67 richard67 - edited - 6 Feb 2021
avatar richard67 richard67 - change - 6 Feb 2021
Labels Added: J4 Issue
avatar richard67 richard67 - labeled - 6 Feb 2021
avatar skurvish
skurvish - comment - 8 Feb 2021

Changing line 447 to the following solved the problem for me.

this.theForm.append(this.orderField);

I confirmed the orderField is actually appended as the last input field of the form.

avatar richard67
richard67 - comment - 12 Feb 2021

Changing line 447 to the following solved the problem for me.

this.theForm.append(this.orderField);

I confirmed the orderField is actually appended as the last input field of the form.

@dgrammatiko Could you have a quick look on this issue? Is the change suggested here by the author right? If so, he or me can make a PR if you are too busy, and if not and you guide me the way, I can make one.

avatar dgrammatiko
dgrammatiko - comment - 12 Feb 2021

Seems legit

avatar richard67
richard67 - comment - 12 Feb 2021

@skurvish Would you like to make a pull request with your suggested change? Or shall someone else do it?

avatar skurvish
skurvish - comment - 12 Feb 2021

I don't currently have a repo set up to PR with so if someone else could PR it I would appreciate it.

avatar richard67
richard67 - comment - 12 Feb 2021

Ok, thanks for reporting.

avatar richard67
richard67 - comment - 12 Feb 2021

I will make a PR.

avatar richard67 richard67 - close - 12 Feb 2021
avatar richard67
richard67 - comment - 12 Feb 2021

Closing as having a pull request. Please test #32396 . Thanks in advance, thanks @skurvish for reporting the issue and providing the right fix, and thanks @dgrammatiko for checking it.

avatar richard67 richard67 - change - 12 Feb 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-02-12 11:49:13
Closed_By richard67
avatar richard67
richard67 - comment - 12 Feb 2021

@skurvish Could you give the pull request #32396 for this issue a test? In your case, as you already have tested the fix, it is enough to verify that the PR only does what you have suggested, and then go to our issue tracker here https://issues.joomla.org/tracker/joomla-cms/32396 , use the "Test this" button, select the right test result and then submit. Thanks in advance.

Add a Comment

Login with GitHub to post a comment