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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。