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.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan