I need to access the grid data after it has been loaded to initialize some features. I have tried using load() with a callback and the “onxle” event but neither appear to be very reliable. I am seeing that sometimes the dataset is not accessible in the callback:
$$(_a.NAME + '_grid').attachEvent("onxle", dhx.bind(_a.onAfterLoad, _a));
onAfterLoad: function () {
var _a = this;
try {
// Fetch the total records number
if ($$(_a.NAME + "_grid").dataCount() < 1) {
_a.notify("No records found", "Data Loading");
}
else {
// Sometimes the first record is 'undefined'
_a.dataCount = $$(_a.NAME + "_grid").item($$(_a.NAME + "_grid").first()).userData.total;
}
} catch (e) {
_a.Error("onAfterLoad", e);
}
},