var MyPanelUi = Ext.extend(Ext.Panel, { title: '上市公司股价信息', width: 764, renderTo:'mainDiv', initComponent: function() { this.items = [ { xtype: 'form', title: '', layout: 'hbox', formId: 'searchFrm', bodyStyle: 'background:#d6e3f3; padding:10px;', fieldDefaults: { labelAlign: 'right', labelWidth: 70, anchor: '100%' }, defaults: { margins: '5 40 0 0' }, items: [ { xtype: 'textfield', fieldLabel: '公司名称', name: 'userName', allowBlank: false }, { xtype: 'numberfield', name: 'price', fieldLabel: '股价', value: 5, minValue: 0, maxValue: 50 }, { xtype: 'button', text: '查 询' //,iconCls:'searchBtn' } ] }, { xtype: 'grid', title: '股价信息列表', id : 'mygrid', height: 323, store: ds, columns : [ { id :'company', text : 'Company', flex: 1, sortable : true, dataIndex: 'company' }, { text : 'Price', width : 75, sortable : true, dataIndex: 'price' }, { text : 'Change', width : 75, sortable : true, renderer : change, dataIndex: 'change' }, { text : '% Change', width : 75, sortable : true, renderer : pctChange, dataIndex: 'pctChange' }, { text : 'Last Updated', width : 85, sortable : true, renderer : Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange' }, { text: 'Rating', width: 30, sortable: true, renderer: rating, dataIndex: 'rating' } ], bbar: { dock: 'bottom', xtype: 'pagingtoolbar', store: ds, pageSize: 25, displayInfo: true, displayMsg: '当前 {0} 到 {1} 条 共有 {2}条', emptyMsg: '没有可供显示的数据' }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', iconCls: 'add', text: '添加', handler: function () { var column=Ext.getCmp('mygrid').columns; alert(column); //alert(Ext.getCmp('mygrid').column.getColumnCount()); } }, { xtype: 'button', iconCls: 'update', text: '修改' }, { xtype: 'button', iconCls: 'remove', text: '删除' } ] } } ]; MyPanelUi.superclass.initComponent.call(this); } });
- var column=Ext.getCmp('mygrid').columns;
-
alert(column);
怎么取到所有columns的header 表头名