Ext.grid.GridPanel的扩展

Ext.grid.GridPanel的扩展的扩展很简单:

只需要从写下面的部分即可

1.this.sm ,grid的选择模式

2.this.colModel,grid的列模型

3.this.store ,grid的数据来源

如果分页,就在写个this.bbar,在里面放分页菜单this.bbar = {xtype:"paging"};

 

Ext.namespace("Ext.ux.grid");
/**
 * grid
 * @class Ext.ux.grid.grid.MyGrid
 * @extends Ext.grid.GridPanel
 * @author master
 */
Ext.ux.grid.MyGrid= Ext.extend(Ext.grid.GridPanel, {
   width: 200,
   title:"myGird",
   // autoHeight:true,
   // autoWidth:true,
   allowPage:true,
   autoScroll: true,
   enableColumnMove: false,
   enableHdMenu: false,
   initComponent: function()
   {
    this.sm = new Ext.grid.RowSelectionModel({
       singleSelect: true
      });
    this.colModel = new Ext.grid.ColumnModel([{
       header: "ID",
       dataIndex: "id",
       hidden: true,
       fixed: true
      }, {
       header: "代码",
       dataIndex: "code",
       sortable: true
      }, {
       header: "名称",
       dataIndex: "name",
       sortable: true
      }]);
    this.store = new Ext.data.JsonStore({
       url: "BBM/loadByUserId.action",
       root: "list",
       method: "post",
       totalProperty: "totalCount",
       fields: ["id", "code", "name"]
      });
    if(this.allowPage){
    this.bbar = {xtype:"paging"};
    }
    this.enableDrag = true;
    this.enableDragDrop = true;
    this.stripeRows = true;
    this.loadMask = {
     msg: "数据加载中,请稍等..."
    };
    Ext.ux.grid.MyGrid.superclass.initComponent
      .call(this);
    this.store.load({start:0,limit:100});
   }
  });
Ext.reg("myGrid", Ext.ux.grid.MyGrid);
/*Ext.onReady(function()
  {
   var viewPort = new Ext.Viewport({
      layout: 'border',
      items: [{
         region: 'center',
         xtype: 'myGrid'
        }]
     });
  });
  */

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值