ExtJs获取grid表头的checkBox

    initComponent: function () {

   this.callParent(arguments);

     this.on('specialkey', function (f, e) {
      if (e.getKey() == e.ENTER) {
      this.onTrigger2Click();
      }
   }, this);
   this.headerCt.on("headerclick", function (ct, column, e, t, opts) {
      var checkHead = ct.gridDataColumns[1];
      if (checkHead.hasCls('x-grid-hd-checker-on')) {
        alert('全选');
      }
      else {
        alert('取消全选');
      }
   });

 }

转载于:https://www.cnblogs.com/servant/archive/2012/09/26/2703443.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ExtJS4 中,可以使用 Ext.grid.header.Container 和 Ext.grid.column.Column 类来实现多层表头。具体步骤如下: 1. 创建一个 Ext.grid.Panel 实例,并定义表格的配置项。 2. 使用 Ext.grid.header.Container 类创建表头容器,设置容器的布局和样式。 3. 使用 Ext.grid.column.Column 类创建表头,设置的文字、宽度、数据域等属性。 4. 将表头添加到表头容器中,并设置表头的嵌套关系,即将子表头添加到父表头的子项中。 5. 将表头容器设置为表格的顶部工具栏,通过表格的 reconfigure 方法重新加载数据。 示例代码如下: ``` var grid = Ext.create('Ext.grid.Panel', { columns: [ { text: 'Group 1', columns: [ { text: 'Name', dataIndex: 'name', width: 100 }, { text: 'Age', dataIndex: 'age', width: 50 } ] }, { text: 'Group 2', columns: [ { text: 'City', dataIndex: 'city', width: 100 }, { text: 'Country', dataIndex: 'country', width: 100 } ] } ], store: store, tbar: { xtype: 'headercontainer', items: [ { xtype: 'gridcolumn', text: 'Group 1', columns: [ { text: 'Name', dataIndex: 'name', width: 100 }, { text: 'Age', dataIndex: 'age', width: 50 } ] }, { xtype: 'gridcolumn', text: 'Group 2', columns: [ { text: 'City', dataIndex: 'city', width: 100 }, { text: 'Country', dataIndex: 'country', width: 100 } ] } ] }, height: 200, width: 400, renderTo: Ext.getBody() }); ``` 其中,store 是数据源,可以使用 Ext.data.Store 类创建。在这个示例中,表头容器使用了 Ext.grid.header.Container 类,并且设置了 xtype 为 'headercontainer',表头使用了 Ext.grid.column.Column 类,并且设置了 xtype 为 'gridcolumn'。表头的嵌套关系通过 columns 属性实现。最后,表头容器作为表格的顶部工具栏,通过 tbar 属性设置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值