I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Thursday 22 April 2010

Ext JS Tutorial - Namespaces

In this entry I will give a tutorial on using Ext JS Namespaces.

Namespaces are a very useful functionality in extJS. You can define a namespace using:

var myNamespaceNS = new ext.Ext.NS('my.namespaces.mymodules');

Then you can add objects, or functions to the namespaces as easily as if they were normal variables:

myNamespaceNS.myObject = {title:'my title',author:'me'};

In other pieces of the code, you can get the hold of the namespace using its name or a variable.

var myNamespaceNS = new ext.Ext.NS('my.namespaces.mymodules'); alert(myNamespaceNS.myObject.title + " "+my.namespaces.mymodules.myObject.author);