No Code Attached Yet
avatar samuelagus
samuelagus
4 Apr 2024

Steps to reproduce the issue

I have some filter field in my custom component, one of them is "Name Filter" which get the dropdown list from SQL form field.

This is the "Filter Options" screenshot:
Filter-Name

This is the XML ( /models/forms/filter_itemdetails.xml ) :
<field name="name"
id="name"
type="sql"
label="COM_MYCOMPONENT_FORM_LBL_ITEMDETAIL_NAME"
description="COM_MYCOMPONENT_FORM_DESC_ITEMDETAIL_NAME"
sql_select="name, date"
sql_from="#__itemdetails"
sql_order="date DESC"
sql_group="name"
key_field="name"
value_field="name"
header="Name Filter"
layout="joomla.form.field.list-fancy-select"
onchange="this.form.submit();
/>

The filtering is works fine.
But the problem occurs when filtering by "Name Filter" then Clear it.
"Name Filter" works normally (the table filtered by Name), but when I click "Clear" button, the table is still filtered by "Name Filter", it should be Reset the filtering (no filter anymore).
The Clear problem (Resetting the Name Filter) will be solve if I click the little cross icon (in the blue circle in my attached screenshot), then the table will be show all datas (no Name Filter anymore)

I try to remove the layout="joomla.form.field.list-fancy-select" from sql field, then the Clear button works fine.
I guess it (the layout) may be the cause of this problem.
But if I don't use this layout, the filtering dropdown will be just show a select list (not combo box), so I need "combo box" for this Name filter :)

Expected result

SQL Filtering can be cleared by click the "CLEAR" button

Actual result

The Clear button can not Reset/Clear the Name Filtering (SQL form field)

System information (as much as possible)

Joomla v4.4.3
PHP 8.3

Additional comments

avatar samuelagus samuelagus - open - 4 Apr 2024
avatar joomla-cms-bot joomla-cms-bot - change - 4 Apr 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Apr 2024
avatar samuelagus samuelagus - change - 4 Apr 2024
The description was changed
avatar samuelagus samuelagus - edited - 4 Apr 2024
avatar samuelagus samuelagus - change - 4 Apr 2024
The description was changed
avatar samuelagus samuelagus - edited - 4 Apr 2024
avatar Hackwar
Hackwar - comment - 4 Apr 2024

Not disagreeing with you on the bug, but why do you have an id attribute? You can remove that and it would still generate an ID for your field, although one slightly different.

avatar samuelagus
samuelagus - comment - 5 Apr 2024

Not disagreeing with you on the bug, but why do you have an id attribute? You can remove that and it would still generate an ID for your field, although one slightly different.

Do you mean: id="name" ?
OK, I remove the ID in the XML, but the problem still happened.
"Clear" button did not clear the filter.

avatar chmst
chmst - comment - 5 Apr 2024

Do you need the layout="joomla.form.field.list-fancy-select"? If not, the filter will be cleared.

avatar samuelagus
samuelagus - comment - 5 Apr 2024

Do you need the layout="joomla.form.field.list-fancy-select"? If not, the filter will be cleared.

Yes, I need the layout to utilize the combo box, because the data list is very large, it's a bit difficult to choose from the select options list without combo-box

avatar samuelagus
samuelagus - comment - 9 Apr 2024

I just realized that besides clicking the little cross icon (in the blue circle in my attached screenshot), pressing the refresh button on the browser will clear (reset) the Name filter.
Is this "not auto-refreshing" thing the cause of the failure to reset the filter?

May this additional information help to find the cause of the problem?

Add a Comment

Login with GitHub to post a comment