/*
- My test
- */ MyDesktop.GridWindow1 = Ext.extend(Ext.app.Module, { id:'grid-win1', init : function(){ this.launcher = { text: '我的测试,嘿嘿', iconCls:'icon-grid', handler : this.createWindow, scope: this } },
createWindow : function(){
/*
- 对生成的表格进行扩展
- */ var ds = new Ext.data.JsonStore({ remoteSort:true, url:'/newDesktop/fixinfo/getAll', fields:[ 'a','b','c','d','e', 'f','hhh','ggg' ], baseParams:{ limit:10 } }); ds.load({ params:{start:0} }); //end
var thisGrid = new Ext.grid.GridPanel({
border:false,
store:ds,
columns:[
{header:'设备编号',dataIndex:'a',width:100,sortable:true},
{header:'设备名称',dataIndex:'b',width:100},
{header:'型号规格',dataIndex:'c',width:100},
{header:'区域',dataIndex:'d',width:80},
{header:'设备类型',dataIndex:'e',width:100},
{header:'生产国别',dataIndex:'f',width:100},
{header:'生产厂家',dataIndex:'hhh',width:100},
{header:'出厂编号',dataIndex:'ggg',width:100}
],
viewConfig: {
forceFit:true
},
//autoExpandColumn:'company',
bbar:new Ext.PagingToolbar({
store:ds,
pageSize:10,
displayinfo:'true',
displayMsg:'显示第{0}条记录到第{1}条记录,一共{2}条',
emptyMsg:'没有记录'
}),
tbar:[{
text:'增加设备',
tooltip:'点击这里来增加设备',
iconCls:'add',
handler:this.createUser.createDelegate(this)
}, '-', {
text:'修改设备',
tooltip:'选定一条记录后进行修改',
iconCls:'option',
handler:this.EditUser.createDelegate(this)
},'-',{
text:'删除设备',
tooltip:'选定一条设备之后进行删除',
iconCls:'remove'
}]
})
var desktop = this.app.getDesktop();
var win = desktop.getWindow('grid-win1');
if(!win){
win = desktop.createWindow({
id: 'grid-win1',
title:'我的测试',
width:740,
height:480,
iconCls: 'icon-grid',
shim:false,
animCollapse:false,
constrainHeader:true,
layout: 'fit',
items:thisGrid
});
}
win.show();
},
createUser:function(){
this.fixInfoWindow = new FixInfoWindow({
grid:this
});
this.fixInfoWindow.show();
//this.FixInfoWindow.setTitle('新建用户资料');
//this.FixInfoWindow.url = 'user/save'; //此处的url对应着UserController的save()方法
//this.FixInfoWindow.fp.form.reset();
},
EditUser:function(){
var rec =thisGrid.getSelectionModel().getSelected();
alert(rec)
if(rec){
this.fixInfoWindow = new FixInfoWindow({
grid:this
});
this.fixInfoWindow.show();
this.fixInfoWindow.fp.form.loadRecord(rec);
}
else{Ext.Msg.alert("出错了","请选择一条记录操作"); }
}
});