Event Fired after Grid Rendered


#1

Is it possible to launch code after the grid is rendered. I tried to use then after data.load but it doesn’t work. It seems that the data are not rendered.


#2

Have a look at the dhx.awaitRedraw helper. I think it will do what you’re looking for. I haven’t used it yet myself, so you’ll have to rely on the snippet linked in the documentation.


#3

load() method returns the promise, so you are able to use:

grid.data.load(url).then(function(){
  console.log("data was finally loaded");
});

#4

The problem is it seems that the data are rendered after they are loaded. So using then don’t work because the data aren’t rendered.


#5

at this moment you are able to access the data completely. You may try to add the awaitRedraw in this structure, like kcasarez have mentioned, for an additional delay but there is no actual need in that:
https://docs.dhtmlx.com/suite/helpers__await_redraw.html

grid.data.load(url).then(function(){
dhx.awaitRedraw().then(function() {
  console.log("now i'm here");
})
});