View Full Version : Reset state?

25 Dec 2006, 9:23 PM
Hi all

The restoreState() works wonderfully, but I was wondering if there was a way to reset the entire layout/all element states through the click of a button.

I have been looking at state.Manager.clear() but its looking for a name parameter which may or may not be the element id

Any ideas would be greatly appreciated

26 Dec 2006, 3:43 AM
They all use elementId-state. If you don't know the element id, you can always use some cookie function from the web to clear the cookies. All yui-ext state cookies begin with 'ys-' so it should be easy enough to filter them.

11 Nov 2007, 4:01 PM
I tried this but it doesn't seem to work (Ext 2.0)

var ca = document.cookie.split(';');
var stateprovider = Ext.state.Manager.getProvider();

for(var i=0; i < ca.length; i++) {
var c = ca[i];

if (c.indexOf('ys-') > 0) {
var cookieName = c.substring(0, c.indexOf('='));
stateprovider.set(cookieName, '');
stateprovider.clear(cookieName, '');