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

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


1 Reply

JC Joseph Christ Nithin Issack Syncfusion Team November 22, 2022 09:18 PM

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.


Loader.
Live Chat Icon For mobile
Up arrow icon