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

Impossible to extend from YAHOO.widget.Tab

Expand Messages
  • Andrei Michnea
    Hello, ... YAHOO.namespace( EventModule ); //subclass Tab YAHOO.EventModule.TabClosable = function(el, userConfig){
    Message 1 of 3 , Mar 6, 2008
    • 0 Attachment
      Hello,

      I tried to extend from YAHOO.widget.Tab using:

      ----------------

      YAHOO.namespace("EventModule");

      //subclass Tab
      YAHOO.EventModule.TabClosable = function(el, userConfig){
      YAHOO.EventModule.TabClosable.superclass.constructor.call(this, el,
      userConfig);
      };

      YAHOO.extend(YAHOO.EventModule.TabClosable, YAHOO.widget.Tab);

      -----------------

      When I call the extended class:

      -----------------

      tabView = new YAHOO.widget.TabView();

      tabView.addTab( new YAHOO.EventModule.TabClosable({
      label: 'label1',
      content: '<p>Text1</p>',
      active: true
      }));

      -----------------

      I get the error (Firefox): this.get("element").getElementsByTagName is
      not a function, utilities.js (line 32)

      Any ideas ?

      Thanks,
      Andrei M
    • thunder6435
      Andrei, You need to look at how the YAHOO.widget.Tab is constructed and emulate that. You need to pay special attention to the arguments el and userConfig.
      Message 2 of 3 , Mar 6, 2008
      • 0 Attachment
        Andrei,

        You need to look at how the YAHOO.widget.Tab is constructed and
        emulate that. You need to pay special attention to the arguments el
        and userConfig. When you create your tab, you only give it one
        argument which are the attributes of the tab. So in you TabClosable
        what you think are userConfig is really el and userConfig is undefined.

        Hope that helps

        -Jeff

        --- In ydn-javascript@yahoogroups.com, "Andrei Michnea"
        <andrei062@...> wrote:
        >
        > Hello,
        >
        > I tried to extend from YAHOO.widget.Tab using:
        >
        > ----------------
        >
        > YAHOO.namespace("EventModule");
        >
        > //subclass Tab
        > YAHOO.EventModule.TabClosable = function(el, userConfig){
        > YAHOO.EventModule.TabClosable.superclass.constructor.call(this, el,
        > userConfig);
        > };
        >
        > YAHOO.extend(YAHOO.EventModule.TabClosable, YAHOO.widget.Tab);
        >
        > -----------------
        >
        > When I call the extended class:
        >
        > -----------------
        >
        > tabView = new YAHOO.widget.TabView();
        >
        > tabView.addTab( new YAHOO.EventModule.TabClosable({
        > label: 'label1',
        > content: '<p>Text1</p>',
        > active: true
        > }));
        >
        > -----------------
        >
        > I get the error (Firefox): this.get("element").getElementsByTagName is
        > not a function, utilities.js (line 32)
        >
        > Any ideas ?
        >
        > Thanks,
        > Andrei M
        >
      • Andrei Michnea
        Jeff, Thanks for the advice. I implement 2 cases to call the superclass constructor and is working fine. ... Andrei M
        Message 3 of 3 , Mar 6, 2008
        • 0 Attachment
          Jeff,

          Thanks for the advice.

          I implement 2 cases to call the superclass constructor and is working
          fine.

          ---
          Andrei M

          --- In ydn-javascript@yahoogroups.com, "thunder6435" <jeff.a.bell@...>
          wrote:
          >
          > Andrei,
          >
          > You need to look at how the YAHOO.widget.Tab is constructed and
          > emulate that. You need to pay special attention to the arguments el
          > and userConfig. When you create your tab, you only give it one
          > argument which are the attributes of the tab. So in you TabClosable
          > what you think are userConfig is really el and userConfig is undefined.
          >
          > Hope that helps
          >
          > -Jeff
          >
          > --- In ydn-javascript@yahoogroups.com, "Andrei Michnea"
          > <andrei062@> wrote:
          > >
          > > Hello,
          > >
          > > I tried to extend from YAHOO.widget.Tab using:
          > >
          > > ----------------
          > >
          > > YAHOO.namespace("EventModule");
          > >
          > > //subclass Tab
          > > YAHOO.EventModule.TabClosable = function(el, userConfig){
          > > YAHOO.EventModule.TabClosable.superclass.constructor.call(this, el,
          > > userConfig);
          > > };
          > >
          > > YAHOO.extend(YAHOO.EventModule.TabClosable, YAHOO.widget.Tab);
          > >
          > > -----------------
          > >
          > > When I call the extended class:
          > >
          > > -----------------
          > >
          > > tabView = new YAHOO.widget.TabView();
          > >
          > > tabView.addTab( new YAHOO.EventModule.TabClosable({
          > > label: 'label1',
          > > content: '<p>Text1</p>',
          > > active: true
          > > }));
          > >
          > > -----------------
          > >
          > > I get the error (Firefox): this.get("element").getElementsByTagName is
          > > not a function, utilities.js (line 32)
          > >
          > > Any ideas ?
          > >
          > > Thanks,
          > > Andrei M
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.