ExtJs之编辑表(Ajax框架

Ext.onReady(function(){
    Ext.QuickTips.init();

    var fm = Ext.form;
 var sm = new Ext.grid.CheckboxSelectionModel({handleMouseDown: Ext.emptyFn});<!--设置列首是否为复选样式-->
 
    var cm = new Ext.grid.ColumnModel([
  new Ext.grid.RowNumberer()<!--列首是否为行的索引-->
  ,{
   header:'编号',<!--列名-->
   dataIndex:'id',<!--对应数据的属性名-->
   width:60
  },{
   header: "书名",
   dataIndex: 'title',
   editor: new fm.TextField({
    allowBlank: false
   }),
   width:100
        },{
   header: "作者",
   dataIndex: 'author',
   editor: new fm.TextField({
    allowBlank: false
   }),
   width:100
  }
            ]);
 <!--设置默认的排序开启-->
    cm.defaultSortable = true;

 

 var store =new Ext.data.JsonStore({
  <!--指明连接的strutsAction的路径-->
      url: 'books.do',
      <!--指明数据存放的位置-->
      root: 'members',
      <!--指明列名对应的数据列名-->
      fields: ['id','title','author']
  });
   <!--加载数据-->
 store.load();
 <!--构建编辑表-->
 var g=new Ext.grid.EditorGridPanel({
  cm:cm,
  <!--对层进行重画-->
  renderTo:"member_grid",
  <!--指明数据集-->
  store:store,
  <!--自适应表格的高度-->
  <!--autoHeight:true,-->
  autoSizeColumns :true,
  width:300,
  height:150,
  <!--产生滚动条-->
  collapsible: true,
     animCollapse: false,
  enableDragDrop :true,
  sm:sm,<!--是否单选或者多选-->
  <!--工具栏-->
  tbar:[{
            text:'添加',
            tooltip:'添加',
            iconCls:'add'
           
        },'-',
        {
         text:'修改',
            tooltip:'修改',
            iconCls:'option'
        }
        ]
 });

 
});
 

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值