Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
585
How to bind events after initialization?
posted

A lot of places mentioned that client-event can be binded anywhere in the application after initialization. However, I have been following different ways that mentioned in the documentation but with no luck. I alrady have the RowSelectors enabled in the feature option at ig.Loader.

Here are some that I have been trying but none of them get fired:

$("#grid1").bind("iggridrowselectorsrowselectorclicked", onRowSelectorClicked);

where the onRowSelectorClicked is a separate function in the same .js file.

OR

$(document).delegate("#grid1", "iggridrowselectorsrowselectorclicked", function (evt, ui) {...});

OR

$("#grid1").live("#iggridrowselectorsrowselectorclicked" , function (evt, ui) {...});

Thanks helping in advance.

  • 24671
    posted

    Hi,

    if you use live / delegate / on, it shouldn't matter where you put the event binding logic. If you use bind(), it does matter. In order to answer your question, i need to have a look at the rest of the code which initializes the grid, as well as how the event binding logic is placed relative to the initialization code. I just tried some of the events using delegate/live, and it seems to work fine. 

    Thanks,

    Angel