We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Binding more than one function to an event

Hi.

Is it possible to bind more than one function to an event, at different points in the code.

For example, in one part of the code I would have:

grid.option({ rowSelected: doSomething1 });

Then in another part of the code I would have:

grid.option({ rowSelected: doSomething2 });

And then when the row is selected, both functions trigger.

Using the above style I'm finding that only one is triggering. Is there a way to make both trigger?

Thanks.

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team February 18, 2016 09:55 AM UTC

Hi Greg,

Thanks for contacting Syncfusion support.

Yes, we can trigger both the events using jQuery on method, which triggers more than one function on event. In this event, the name should be Plugin + eventName, for example: ejGrid + rowSelected.

Please find the code example and sample:


$(function(){
   
            $("#Grid").ejGrid({
                dataSource: window.gridData,
                allowPaging: true,
                selectionType:"multiple",
                columns: [
                  -----------------------------------------------------
                ]              
            });
   
      $("#Grid").on("ejGridrowSelected", function(e){alert(1)});
      $("#Grid").on("ejGridrowSelected", function(e){alert(2)});


Sample : http://jsplayground.syncfusion.com/30i4sux5

Regards,
Prasanna Kumar N.S.V


Loader.
Up arrow icon