Skip to: Site menu | Main content

Email Facebook LinkedIn Twitter Google

Blog...

Extending a Yahoo UI widget.

Recently, I had the need to determine if a YAHOO.widget.TextNode with a specific label existed within a parent node, also an instance of YAHOO.widget.TextNode. I decided to create a custom YAHOO.widget.TextNode by extending the class. This is the first time I've tried to use any OO javascript. I was quite pleased with how easy I could extend any class. Thanks mostly to the excellent documentation provided by Yahoo.

Here's how I did it:

I started by creating node.js to hold my class definition:

I created a custom namespace "JTC.widget"


YAHOO.namespace("JTC.widget");

Create a constructor with the same signature as YAHOO.widget.TextNode and chain the superclass constructor.


YAHOO.JTC.widget.Node = function(oData, oParent, expanded) {
YAHOO.JTC.widget.Node.superclass.constructor.call(this, oData, oParent, expanded);
};

[More]

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Thanks a lot Jason.
That hellped me a lot.
# Posted By Snig | 9/18/08 6:07 AM