Skip to: Site menu | Main content

Welcome to JasonHolden.com

Here you'll find information about my work and services.

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.)
BlogCFC was created by Raymond Camden. This blog is running version 5.7.002.