Wiring Events

15 Sep 20171 minute to read

Essential JS widgets events can be wired the same way as jQuery events are bound, either during or after control initialization.

During Initialization

  • js
  • $("jquery-selector").ej-plugin-name({ eventName : "eventHandler" });
    //Example
    $("#myDate").ejDatePicker({ select: function () { 
              // event handler 
       }  
    });

    After initialization

  • js
  • // First way
    $("jquery-selector").ej-plugin-name("model.eventName", "eventHandler");
    //Example
    $("#myDate").ejDatePicker("model.destroy" , function () {
          // event handler
    });
    
    // Second way
    $("jquery-selector").on("ej-plugin-nameEventName", "eventHandler");
    //Example
    $("#myDate").on("ejDatePickerDestroy", function () {
          // event handler
    });