State loading with grouping issues

Hello syncfusion,

We've been talking about grid state save some time ago in this thread:


And now I found an issue with grouping when using the state loading. I'm not sure if that issue was around all the time or not, but I can represent it in given sample from previous thread.


I will try to tell the sequence to get into error or unexpected behaviour.

First of all we will group grid by category name


After we group grid, click to save PersistData and remove grouping



Then we click Resetto get saved state with grouping and then the "length" error appeared in the console



After that I tried to put another column in grouping and it grouped by BOTH columns but in header it is showing only one



When removing the second group column, that column grouping is removed but the grouping header is displayed as empty





3 Replies

MS Madhu Sudhanan P Syncfusion Team October 12, 2018 08:53 AM UTC

Hi Domantas, 

Thanks for contacting Syncfusion support. 

We have validated your query and the provided information. We suggest you to use the below way to resolve the reported problem. In the below sample we have assign the column property separately through setProperties of grid so there is no need to call the refreshColumn method  to reset the grid state. 

Please refer to the below code example and updated sample for more information. 

Index.html 
<button id='persist' onclick="getPersistData()"> Reset</button> 
function getPersistData(){ 
. . . . . 
if (data) { 
gridInst.setProperties({ 
      columnModel: data.columns, 
  }) 
  gridInst.setProperties({ 
      sortSettings: { columns: data.sortSettings.columns }, 
      groupSettings: {columns:data.groupSettings.columns}, 
      filterSettings: data.filterSettings, 
      pageSettings: {pageSize:data.pageSettings.pageSize, currentPage:data.pageSettings.currentPage, pageCount: data.pageSettings.pageCount}, 
      searchSettings: {fields:data.searchSettings.fields, key:data.searchSettings.key} 
  }) 
} 



Regards, 
Madhu Sudhanan P 



DO Domantas October 12, 2018 09:30 AM UTC

Hello,

Reviewed your answer. You removed the setProperties second parameter (true) that was written to avoid multiple loads and load everything at once. 

Without that parameter it does work as you wrote cause it's applying settings one by one, but this was a main problem from previous thread that I wrote before. If you're not setting all parameters at once grid calls back-end multiple times after each setting applied and it's a huge problem.


Please review the issue and how to solve the problem with single load when passing setProperties second parameter as "true".





MS Madhu Sudhanan P Syncfusion Team October 15, 2018 08:57 AM UTC

Hi Domantas, 

Thanks for your update. 

We suggest you to use the below way to resolve the reported problem(multiple loads). Please refer to the below code example and sample for more information. 

function getPersistData(){ 
    
           if (data) { 
               gridInst.setProperties({ 
                  columnModel: data.columns, 
                   sortSettings: { columns: data.sortSettings.columns }, 
                   filterSettings: data.filterSettings, 
                   pageSettings: {pageSize:data.pageSettings.pageSize, currentPage:data.pageSettings.currentPage, pageCount: data.pageSettings.pageCount}, 
                   searchSettings: {fields:data.searchSettings.fields, key:data.searchSettings.key} 
    
               }, true) 
               gridInst.setProperties({ 
                   groupSettings: {columns:data.groupSettings.columns}, 
               }) 
           } 
    } 



Regards, 
Madhu Sudhanan P 


Loader.
Up arrow icon