We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Disable persisted state for grid's filtering and sorting functionality

Hi Team,

Persisted state for grids was added, and it was a complete success. Is it possible to turn off persisted state for column filtering and sorting? Please advise me on how to accomplish this.


Regards,
Cyril Ovely


1 Reply 1 reply marked as answer

VB Vinitha Balasubramanian Syncfusion Team December 9, 2022 12:43 PM UTC

Hi Cyril,


Greetings from Syncfusion support.


Query : Disable persisted state for grid's filtering and sorting functionality


From your query, we understand that you want to prevent persisted state for column filtering and sorting. We prepared a sample to remove the filterSettings and sortSettings from the persistence in the addOnPersist method using dataBound event. Please refer the below code, documentation and sample for more information


[App.vue]

 

dataBound: function (args) {

      var cloned = this.$refs.grid.ej2Instances.addOnPersist;

      this.$refs.grid.ej2Instances.addOnPersist = function (key) {

        key = key.filter(

          (item) => item !== "filterSettings" && item !== "sortSettings"

        );

        return cloned.call(this, key);

      };

    },


Sample : https://codesandbox.io/s/vue-template-forked-wedu9q?file=/src/App.vue


Documentation : https://ej2.syncfusion.com/vue/documentation/grid/state-persistence/prevent-to-persist/

                               https://ej2.syncfusion.com/vue/documentation/api/grid/#databound


Regards,

Vinitha Balasubramanian


Marked as answer
Loader.
Up arrow icon