/*****************************editorGridPanel实例****************************************************/
js代码:
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());
};
/*****************************editorGridPanel实例 结束****************************************************/
属性信息: