Moving grid's parent object

I have to move grid’s parent object i.e. from one div to other and vice -versa. I used

mygrid.attachToObject() but I have few queries regarding this.



a) Menus are not working when I change parents grid object.

b) How to save current grid’s state in a variable object before moving it to

another parent. So that if I want to revert to older content, I just have

to assign that object to mygrid.

Ex:

var tempGridObj = mygrid’s current state;

mygrid.attachToObject(‘newContainer’);



and later if I dont want the changes made under this parent I just have to say



mygrid = tempGridObj;

mygrid.attachToObject(‘oldContainer’);



Thanks

a) What menus do you mean?
b) To save current grid state you can use method mygrid.getStateOfView(). Method returns details about current grid state:
If paging mode is enabled:
state[0] = number of current active page
state[1] = index of the top row in the page
state[2] = index of the last row in the page
state[3] = number of rows in grid

If paging mode is disabled:
state[0] = index of the top visible row
state[1] = height of the visible area in rows
state[2] = number of rows in grid