Completed
Last Updated: 12 Oct 2020 07:48 by ADMIN
Release 2020.R3.SP.next
Stefan
Created on: 02 Mar 2020 10:47
Category: Grid
Type: Bug Report
0
Persisting options for emptied default filter not working

Take this Dojo: https://dojo.telerik.com/iCECeXeC

1. Press 'Run'
2. Remove the filter for Contact Title
3. Press 'Save State'
4. Reload page (F5)
5. Press 'Run'
6. Press 'Load State'

Result: The filter for Contact Title is not removed.

 

On the other hand if I do the following:

1. Press 'Run'
2. Change the filter for Contact Title to 'Sales Representative'
3. Press 'Save State'
4. Reload page (F5)
5. Press 'Run'
6. Press 'Load State'

Result: The filter for Contact Title is changed correctly to 'Sales Representative'

 

Why is the first example not working? Is this intended behaviour or a bug? Is there a workaround?

 

Kind regards.

2 comments
ADMIN
Silviya Stoyanova
Posted on: 05 Mar 2020 08:17

Hello again, Stefan,

I have logged the described issue as a bug into the Feedback Portal and you could follow the report here, as well as in the Kendo UI Core Github repository if you prefer here.

I would like to thank you for helping us to improve, so I have granted your account with Telerik points.

Thank you!

Regards, Silviya Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
ADMIN
Silviya Stoyanova
Posted on: 04 Mar 2020 10:52

Hello, Stefan,

Thank you for the described example.

In the first case, we are receiving an empty object. This means that on deep copying there are no properties to be shared, so the current object will stay the original one.

At the moment as a workaround, you could check if the object is empty - if true set the DataSource filter object with an empty filter array. This way it will not be replaced, as it is no longer empty object.

$("#load").click(function (e) {
            e.preventDefault();
            var options = localStorage["kendo-grid-options"];
            if (options) {
              var parsedOptions = JSON.parse(options);
              if(!Object.keys(parsedOptions.dataSource.filter).length){
                parsedOptions.dataSource.filter = { filters:[], logic:"and"};
              } 
              grid.setOptions(parsedOptions);
            }
          }); 

We are going to discuss the reported case with the team. I will keep the thread updated.

Thank you

Kind Regards, Silviya Stoyanova Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.