Sorry for inconvenience, it was my mistyping, the correct code is
mygrid.attachEvent(“onBeforeSorting”,function(){
mygrid.changePage(0);
return true;
});
the code need to return true, because in other case sorting will be blocked.