Loading ...
Sorry, an error occurred while loading the content.

Question about custom events (datatable)

Expand Messages
  • andresm1981
    If I understand correctly custom events, you can only subscribe to a custom event after the object that fires the event has been created. I tried subscribing
    Message 1 of 1 , Apr 6 4:46 PM
    View Source
    • 0 Attachment
      If I understand correctly custom events, you can only subscribe to a
      custom event after the object that fires the event has been created.

      I tried subscribing to the tableinitEvent, but because it is fired in
      the constructor, there could not be any subscribers since the object
      has not been created yet.

      The only way that I was able to subscribe to this event is to extend
      Datatable and add a subscriber in the subclass constructor:

      YAHOO.widget.DataTable2 = function(fnSubscriber,elContainer ,
      oColumnSet , oDataSource , oConfigs) {
      this.subscribe("tableInitEvent",fnSubscriber);
      if (arguments.length > 0) {
      YAHOO.widget.DataTable2.superclass.constructor.call(this,
      elContainer , oColumnSet , oDataSource , oConfigs);
      }

      };

      YAHOO.lang.extend(YAHOO.widget.DataTable2, YAHOO.widget.DataTable);


      Are there any other ways to subscribe to this kind of custom events?
    Your message has been successfully submitted and would be delivered to recipients shortly.