日期:2014-05-16  浏览次数:20330 次

ExtJs4 grid panel如何遍历columns
最近在使用EXTJS4 的grid panel,使用多表头展现数据.

JScript code

var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        columns: [
        {
            header: '序号',
            dataIndex: 'xuhao',
            sortable : false,
            width: 100
        }
        , 
        {
            header: '名称',
            dataIndex: 'Name',
            sortable : false,
            width: 100
        }
        , 
        {
           header: '结果',
           columns:[
           {
               header: '本月',
               dataIndex: 'curMonth',
               sortable : false,
               width: 150
           }
           ,
           {
               header: '本年',
               dataIndex: 'curYear',
               sortable : false,
               width: 150
           }]
        }
        , 
        {
           header: '备注',
           dataIndex: 'note',
           sortable : false,
           width: 150
        }
        ]
    });


如何遍历grid.columns所有节点?

------解决方案--------------------
var column=grid.columns; 
var items=column.items.items;
Ext.each(items,function(item){
alert(item.text);
});