Why does the filter reorder items?

1 Answer 38 Views
Filter
Matthew
Top achievements
Rank 1
Matthew asked on 14 Jan 2025, 09:54 PM

This might be more of an enhancement request, but I discovered that the filter widget incorrectly orders items if you reload the state. You can see this functionality in the jQuery demo here: https://demos.telerik.com/kendo-ui/filter/persist-state

Steps to reproduce:

  1. Add a second line to the filter
  2. Change "ContactTitle" to "Country" on the first line
  3. Click "Save State" and then "Load State"
  4. See that the items were reordered

As far as I can tell, this happens because changing a filter line removes the item from the FilterModel and then calls Push which adds it to the end of the array.

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 17 Jan 2025, 12:07 PM

Hello, Matthew,

The reason for the behaviour is the calling of the applyFilter method when the Load State button is clicked. The items are therefore reordered as per the filter configuration, same as if you would have pressed the Apply button.

Let me know if you have any questions on the matter.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Matthew
Top achievements
Rank 1
commented on 17 Jan 2025, 03:24 PM

Can I create a bug ticket for this control then? We allow our users to create a filter which we save to the database via the filter.getoptions() call. When the user comes back to the page, we load their previous filter with the filter.setoptions() call but their filter loads in a different order than they set it up in. This is disorienting to the user.
Martin
Telerik team
commented on 22 Jan 2025, 12:22 PM

Hello, Matthew, 

I am not sure if the behaviour is a bug. When setting the persisted filter, and it is applied, the data is simply being filtered, and the behaviour in the demo is expected, because the filter is being applied programmatically when the Load State button is pressed. Could you please let me know if I am missing something?

Tags
Filter
Asked by
Matthew
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or