a3049967 2012-05-11 10:21
浏览 380
已采纳

extjs4 怎么取到所有columns的header 表头名

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);        }    });
  1.  var column=Ext.getCmp('mygrid').columns; 
  2.                                 alert(column);

 

怎么取到所有columns的header 表头名

  • 写回答

6条回答 默认 最新

  • iteye_3843 2012-05-11 12:18
    关注

    [code="java"]var column=Ext.getCmp('mygrid').getStore().fields;
    alert(column);[/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区