setting enablePersistence to true causes searching problems

Dear,

I have a <ejs-grid> with a e-data-manager (UrlAdaptor).
When I disable "enablePersistence", searching is working fine (using a Syncfusion.EJ2.Base.DataManagerRequest).

However, once I set enablePersistence = "true" on the grid, the searching fails with the error

Exception thrown: 'System.ArgumentException' in System.Linq.Expressions.dll
Incorrect number of arguments supplied for call to method 'System.String ToString(System.String)'

I already tried to clear the persistence state with window.localStorage.clear(); but that doesn't solve anything...
It seems that the persistence is somehow forcing "old" search settings, because I disable searching on some columns, but those columns are still included in the DMRequest. When I disable persistence, these columns do not appear in the DMRequest...

What is causing this and how to solve?



1 Reply 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team August 21, 2020 04:21 PM UTC

Hi Koen, 

Greetings from Syncfusion support. 

Based on your query, we can understand that you wish to clear the Grid’s persisted data from local storage. You can achieve this requirement by destroying the grid after disabling the enablePersistence property and clearing the local storage data. This is demonstrated in the below code snippet,  
 
 
function myfunction2(args) { 
        var gridObj = document.getElementById("Grid").ej2_instances[0]; 
        gridObj.enablePersistence = false; 
        window.localStorage.setItem("gridGrid", ""); 
        gridObj.destroy(); 
//reloads the page 
        location.reload(); 
    } 
 
 
 
Please get back to us if you require any further assistance.   
 
Regards, 
Manivel 


Marked as answer
Loader.
Up arrow icon