r2 - 26 Oct 2007 - 15:03:30 - DovKatzYou are here: TWiki >  JSLoader Web > DemoList > ExtOnDemandDemo
Ext On Demand Demo

DRAFT - I NEVER FINISHED THIS -- DOV

I created an on-load query engine which will look for elements of class "ext-factory" and then tries to make ext widgets out of them based on additional classes. The Table Grid class came from the From-markup example on extjs.com

Here's the table

Name Age Sex
Barney Rubble 32 Male
Fred Flintstone 33 Male
Betty Rubble 32 Female
Pebbles 1 Female
Bamm Bamm 2 Male

Here's what I did

<!-- I use custom classes and a "Factory" to create grids from markup -->
<table cellspacing="0" id="the-table" class="ext-factory ext-table-grid">

<!-- here's what my 'factory' looks like-->
<script>
var ExtFactory= new Object();

// Register a factory class
ExtFactory["ext-table-grid"]=function(elem){     
        var grid = new Ext.grid.TableGrid(elem);
        grid.render();
};

// Initialize the factory
Ext.onReady(function() {
        var creatables=Ext.query(".ext-factory");
        for(var i=0;i<creatables.length;++i){
           for (var ctor in ExtFactory){
                   creatables[i]=Ext.fly(creatables[i]);
                   if(creatables[i].hasClass(ctor)) ExtFactory[ctor](creatables[i]);
           }
 }
});
</script>
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback