Grid losing sort order on UpdateXML

After updateXML call on sorted Grid, Grid does not retain its sort order. Otherwise the grid retains its sort order.

I called following two lines after updateXML but that did not help either.
These lines are called after loadXML command as well.
mygrid.loadSortingFromCookie(‘dsort’);
mygrid.enableSortingSaving(‘dsort’);

Note:
I already have following in my code after mygrid.init()
mygrid.attachEvent(“onAfterSorting”, function(index,type,direction){
mygrid.saveSortingToCookie(‘dsort’);
});

Sorting is one time operation, grid will not auto-resort data when values are changed. So if after updateFromXML data is changed in the grid, it will not cause auto reordering, but if sortRows will be called programmatically or by user’s actions - grid will be correctly corted with new data.

I called mygrid.loadSortingFromCookie(‘dsort’);
after call to updateXML command but did not help. Is there any other command which I need to call?

Try to call it after date loading, like in next snippet

grid.updateFromXML(url, true, false, function(){ grid.loadSortingFromCookie("dsort"); });