Sort in afterinit

I add

grafik

in head of XML. After loading the XML to the grid “onAfterSorting” fires but grid is not sorted.

If I use the same from script

 myreportgrid.load("anyfile.xml", function(){
  myreportgrid.sortRows(2,"str","asc");
});

it works fine. Any idea??

Unfortunately the “afterinit” is not equal to the onXLE. “afterinit” section calls after the header of the grid rendered bu before the data is loaded. While the sorting requires the data to be loaded. So you need to use the callback function or the onXLE event.