Clear persistence status

Hello.

I'm using TreeView with EnablePersistence="true" for displaying a left menu. This works great, because when I reload a page, the expanded nodes remain as before reloading.

But sometimes I need to delete this persistence. I have seen that this state (the expanded nodes) is stored on a cookie on the client side.

How can I force to clear this state?


Thanks

5 Replies

AB Ashokkumar Balasubramanian Syncfusion Team December 18, 2017 12:29 PM UTC

Hi Eligio, 
 
We have checked your query. We suspect that you have tried to clear the cache. We can use the below code block to clear the cache for TreeView component. Please check the below code block. 
 
[Controller][System.Web.Services.WebMethod] public static void StoreData(List<LoadData> data) { System.Web.HttpContext.Current.Session["modifiedData"] = (data.Count > 0 ? data : null); }
 
To know more details about this requirement, please check the below help document. 
 
 
Please let us know, if the provided information’s are helpful to achieve this requirement or not. 
 
Regards, 
Ashokkumar B. 



EL Eligio December 20, 2017 10:24 PM UTC

Thanks for your anwser.

Maybe I'm confused, but I think that this doesn't solve my problem. 

My problem is: this is the initial treeview status:

- PARENT1
  Child1_Parent1
+ PARENT2
+ PARENT3

As you can see, first time only Parent1 is expanded. This is my initial status. Ok until here.

Now, the user starts using treeview, and get this status:

- PARENT1
  Child1_Parent1
- PARENT2
  Child1_Parent2
  Child2_Parent2
+ PARENT3

As you can see, now first and second nodes are expanded. Ok.

The user starts using the website, moving from one page to another, while treeview persist its status. This is ok.

If the user close the browser and open it again, when treeview is displayed it showns as the second status, because EnablePersistence=true. This is what I need to change.
So, I need to "clear" this status when the user open the page the first time in his session. Then, while working in the website etc, persistence is ok. But when the session is closed I need to clear it.


Thanks


AB Ashokkumar Balasubramanian Syncfusion Team December 21, 2017 12:46 PM UTC

Hi Eligio, 
 
Thanks for your update. 
 
We have analyzed your exact requirement clearly. We are able to clear the persistence status at client side by using below code block. 
 
[Script] 
 
window.localStorage.clear(); 
 
 
For your requirement we have suggest you to clear the persistence status on certain time interval or else logout functionality. 
 
Regards, 
Ashokkumar B. 



EL Eligio January 4, 2018 10:40 PM UTC

Great answer.

Thanks


AB Ashokkumar Balasubramanian Syncfusion Team January 5, 2018 05:16 AM UTC

Hi Eligio, 
 
Most Welcome. 
 
Please let us know if you need any further assistance. 
 
Regards, 
Ashokkumar B.  


Loader.
Up arrow icon