EditorGridPanel的一些属性,配置项,方法的实例.自适应窗体大小

页面信息:

grid = new Ext.grid.EditorGridPanel({
    	autoScroll:true,
        store: store,
        sm : new Ext.grid.RowSelectionModel(),
		cm: cm,
        renderTo: 'editor-grid',
        width: '100%',
        height: 600,
        autoWidth:true,
        autoExpandColumn: 'code', // column with this id will be expanded
        title: '客户对账清单',
        frame: true,//是否有边框  默认是没有的
        viewConfig:{
			autoFill:true,
			sortAscText:'升序',
			sortDescText:'降序',
			columnsText:'显示列'
		},
        clicksToEdit: 1,
        tbar:[{
              text: '请输入订单号:'
           },{
              xtype: 'textfield',
              id: 'filter',
              selectOnFocus: true,
              width: 100,
              validationDelay:100,
              validator:function(){
              	store.load({
              		params:{
                       sorderId:this.getValue()//取得搜索表单文本域的值,发送到服务端
                    }
              	});
              },scope:this
           }
        ]
    });

 要加载的columnModel:

 

    var cm = new Ext.grid.ColumnModel({
        defaults: {
            sortable: true // columns are not sortable by default           
        },
        columns: [
            {
                id: 'code',
                header: '物料编号',
                dataIndex: 'code',
                width: 100
            }, {
                header: '物料简称',
                dataIndex: 'shortName',
                width: 100
             }, {
                header: '客户简称',
                dataIndex: 'ComSName',
                width: 100
             }, {
                header: '型号',
                dataIndex: 'style',
                width: 100
             }, {
                header: '单位',
                dataIndex: 'unitName',
                width: 40
             },{
                header: '用料数量',
                dataIndex: 'useCount',
                width: 100
             },{
                header: '入库数量',
                dataIndex: 'GCount',
                width: 100
             },{
                header: '客户库存',
                dataIndex: 'GPrice',
                width: 100
             },{
                header: 'sorderId',
                dataIndex: 'sorderId',
                width: 100
                hidden:true,
                                          //只是在页面上隐藏,但是在页面上可以调整成显示的。
                hideable:false
                                       //这两句让该列彻底隐藏
             }
        ]
    });

 要加载的store:

     var zlUrl=getRootPath()+'XXXServlet?change=stasksDetail';
     var store = new Ext.data.Store({
     	proxy: new Ext.data.HttpProxy({
             url: zlUrl
        }),
        reader: new Ext.data.JsonReader({
        	totalProperty: 'results',
            root: 'rows',
            fields: [
                {name: 'code', mapping: 'code'},
                {name: 'shortName'},
                {name:'ComSName'},
                {name: 'style'},
                {name: 'unitName'},
                {name:'useCount'},
                {name: 'GCount'},
                {name: 'GPrice'},
                {name:'sorderId'}
            ]
        })
    });

 参数的传递发法:

params:{
        sorderId:this.getValue()//取得搜索表单文本域的值,发送到服务端
  }    
window.onresize = function(){ //自适应窗体 
 	grid.setWidth(0); 
        grid.setHeight(0); 
        grid.setWidth(Ext.get("content").getWidth()); 
        grid.setHeight(Ext.get("content").getHeight()); 
    };
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值