onXLE alternate in Grid Event

Hi, I used onXLE event handler when I was using dhtmlxgrid version < 5.x.
But in Version 6.x, I don’t see any detailed event handler (or documentation) on handling events before loading XML or JSON data.

Is there any way I can do that in version 6?

Thanks.

In DHX6 they’re using promise objects in place of the onXLE events in previous versions. This would call functions after the data has been loaded into the component (in your case, the grid). However, since you mentioned “before loading XML or JSON data”, I’m guessing you mean between when the data is received and before it is displayed in the component.

If that’s the case, then I’d recommend just doing a dhx.ajax.get() or dhx.ajax.post() call (whichever is appropriate for your situation) to get the data, and then use the promise objects they return to perform operations on the data before displaying it in the component.

var grid = new dhx.Grid({...});
dhx.ajax.get("/path/to/data").then(function(data){
    // do something with the data JSON object
    grid.parse(data); // put modified data into grid
});

If you don’t need to modify the data BEFORE it goes in the grid, you can use the grid.load() function, which still returns a promise object:

grid.load("/path/to/data").then(function(){
    // perform actions with grid after data is displayed
});
1 Like

Thank you for your help. I will make sure to try them out.

There is a load event in the dataCollection which fires when the data is loaded:
'https://docs.dhtmlx.com/suite/data_collection__api__load_event.html