Hi,
Is it possible to bind an event to a control & the control itself depends on another event handler/delegate.
For example :
I want to bind a function on grid's onCreated OR rendering event & in that function I want to retrieve the selected value of an igCombo, What if the data is not loaded in the igCombo? This delegate requires/depends on the value of igCombo but when the grid's event is executing the data hasn't been bound to the igCombo, What is the solution to that?
If instead I copy the code I want to be executed in grid's onCreated event & paste it in igCombo's databound event, than inside databound event of igCombo there may be a case that the grid has not loaded properly and the code also depends on some data from the grid, But because the grid has'nt been created or the data hasnt loaded in it, I cannot do the same work in igCombo's databound.
In short, wherever I put the code, the other event has to be completed in order for my code to not break. Is there any solution to this kind of problem.
Can a delegate/event handler also wait for another delegate to finish it's work & then execute itself.
In simple words: Do some work on igCombo's selectedValue & igGrid on igGrid's any event (onCreated/rendering/rendered/etc).
Hello,
Please let me know if you have any further questions on that matter.
Okay, got it. Thanks for replying.
Hello Jimmy,
I'm afraid you cannot configure the delegate to wait for another one to finish. I think it is better to re-design your application (if possible) so that your code would not break in such a scenario.
However following the simplest similar scenario - igGrid and igCombo in one page and handling the "created" event of the grid and "dataBound" event of the combo:
$(document).delegate("#grid", "igcontrolcreated", function (evt, ui) { $("#grid").igGridUpdating("setCellValue", x, "LastName", "** It works ! **");});
$(document).delegate("#combo", "igcombodatabound", function (evt, ui) { x = 5; });
As you can see the code inside the "igcontrolcreated" events depends on the code in the other event to execute first, otherwise the code will break ( I hope this is correctly reproducing your issue). What you can do in this scenario is having in mind that the order in which these events will fire depends on the order of the controls initializtions - if the grid is initializes before the combo its event will fire first.
However I'm afraid this would not be a consistent solution across different pages/applications that most probably will implement more complex scenarios/functionalities. I suggest that you try it and I hope this could work for you.