Hi,
I'm experimenting with the kendo Grid at the moment and have been creating something that creates a grid and sends a callback down a chain when the grid's dataBound event is fired. However, a problem that's arisen is there're multiple callbacks trying to link onto the callback event at different points in the chain, like so:
function createGrid(gridOpt) { return new Promise(function (resolve, reject) { gridOpt.dataBound = function () { resolve(); }; $$gridElement.kendoGrid(gridOpt); });}function foo() { var gridOpt = getGridOpt(); createGrid(gridOpt).then(function () { console.log('important thing 2'); });}function getGridOpt() { return { dataBound: function () { console.log('important call 1'); }, //other grid stuff };}
However, this would mean that the second dataBound assignation would override the first.
After initialisationyou can bind events through $$gridElem.data('kendoGrid').bind('dataBound', function(){});
I can't use this in this case, as the dataBound event occurs directly after initialisation.
One option would simply be to check if there is already an existent function and create a wrapper function that will call both functions. This would work, but it's not exactly best practice, and I'm sure there's a way to do it properly and I just missed something.
Is there any way to bind multiple events to the grid before initialisation?
