:: Forum >> Version 2 >>

Composite controls - adding more elements to the grid

More information on this topic is available in the documentation section: /aw.ui.grid/layout-template.html.

It is often necessary to add more elements to the grid, like action toolbar on top of the headers or paging controls in the bottom. The grid has Layout template defined but not used by default - it simply calls the next one (scrolling). However the Layout template can be used to split the control area (for example, with AW.Panels.Horizontal), put the grid in the middle and additional elements into the top/bottom areas.

var obj = new AW.UI.Grid;
    
obj.setSize(800250);
    
obj.setCellText(function(ij){return "-" i});
    
obj.setHeaderText("header");

    
obj.setColumnCount(10);
    
obj.setRowCount(100);

    
obj.defineTemplate("topLine", function(){return "top"});
    
obj.defineTemplate("bottomLine", function(){return "bottom"});

    
obj.setLayoutTemplate(new AW.Panels.Horizontal);
    
obj.setPanelTemplate(function(i){
        switch(
i){
            case 
0: return this.getTopLineTemplate();
            case 
1: return this.getScrollTemplate();
            case 
2: return this.getBottomLineTemplate();
        }
    });

    
obj.setPanelHeight(300); //top line
    
obj.setPanelHeight(202); //bottom line

    
document.write(obj);

 
Alex (ActiveWidgets)
Friday, March 3, 2006
This is very good to know. I have a use for it already!
Jim Hunter (www.FriendsOfAW.com)
Friday, March 3, 2006
I often wondered what the purpose of the Layout template was - as you say it simply calls the Scroll Template !

Great Tip Alex.
Yasdnil
Saturday, March 4, 2006



This topic is archived.

Back to /aw.ui.grid/layout-template.html

Documentation:

Forum search