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
close icon

Unable to get grid local storage value in Vue grid

Hi Team,

Persisted state for grid are working flawlessly as I integrate them into ejs-grid components. But there's a problem: in order to get the localstorage value when the user refreshes or returns to the screen, I need to send currentPage and pageSize to the API.

In the sample that's provided below. There are several tabs that share the same grid element. Based on tabindex, we added dynamic refs.

When attempting to obtain localstorage grid data, I used the following approach. Grid data cannot be obtained using "ref." I tried referring to the documents, but it didn't help much. Please assist me in updating the request parameters upon grid initialization.




Regards,
Cyril Ovely


Attachment: gridpersistedstate_e94fbc90.zip


3 Replies 1 reply marked as answer

JC Joseph Christ Nithin Issack Syncfusion Team November 23, 2022 02:18 AM UTC

Hi Cyril,


  Greetings from Syncfusion support.


  Based on your query, you want to get the grid’s persisted data from the local storage. We have prepared a sample to get the persisted values in the EJ2 Grid.


Refer the code example:


 

methods: {

    btnClick: function (event) {

      var gridProps = JSON.parse(window.localStorage.getItem("gridDestGrid"));

      console.log(gridProps);

    },

  },

 

 



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

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Marked as answer

CO Cyril Ovely December 1, 2022 10:33 AM UTC

Hi Joseph,

Thank you for your reply. It assisted me in updating quest parameters using localStorage information.

I still have a problem to solve. when a user clicks external button. I need to remove all previously applied filters and set the grid's pagination to page "1".

I've added "clearFiltering()" to remove filters. Please assist in setting the grid's pagination to the required page externally.


Regards,
Cyril Ovely



JC Joseph Christ Nithin Issack Syncfusion Team December 2, 2022 04:51 AM UTC

Cyril,


  You can move to the required page by calling the `goToPage` method of the EJ2Grid. Refer the below docuemtentation.


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


Loader.
Live Chat Icon For mobile
Up arrow icon