日期:2014-05-16 浏览次数:20352 次
var sm=new Ext.grid.CheckboxSelectionModel(); //{handleMouseDown:Ext.emptyFn} var cm=new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), sm, {header:'设备条码', dataIndex:'Id' }, {header:'主号', dataIndex:'Mainnum' }, {header:'设备SIM卡号', dataIndex:'SimID' }, {header:'车牌号', dataIndex:'CarID', editor:new Ext.grid.GridEditor( new Ext.form.TextField({ allowBlank:false })) }, {header:'组号', dataIndex:'TearID' }, {header:'平台服务期', dataIndex:'LimitTime',type:'date',renderer:Ext.util.Format.dateRenderer('Y年m月d日') }, {header:'注册时间', dataIndex:'RegisteredTime',type:'date',renderer:Ext.util.Format.dateRenderer('Y年m月d日') }, {header:'设备状态', dataIndex:'EquipmentState' } ]); var webAction = "firstLoadDeviceTree"; //定义执行查询所有信息,还是指定信息的参数变量 var contentStr = ""; //定义查询时的参数变量 var store=new Ext.data.Store({ proxy:new Ext.data.HttpProxy({url:'http://192.168.16.120/123/DataPage.aspx'}), reader:new Ext.data.JsonReader({ totalProperty: 'totalProperty', root: 'root' },[ {name:'Id'}, {name:'Mainnum'}, {name:'SimID'}, {name:'CarID'}, {name:'TearID'}, {name:'LimitTime',type:'date',dateFormat:'Y-m-d'}, {name:'RegisteredTime',type:'date',dateFormat:'Y-m-d'}, {name:'EquipmentState'}, ]), pruneModifiedRecords:true }); //var ogrid = this.grid; var grid=new Ext.grid.EditorGridPanel({ height:500, //width:980, layout:'fit', store:store, loadMask:{msg:'数据加载中,请稍侯……'}, cm:cm, sm:sm, selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),//设置单行选中模式, 否则将无法删除数据 viewConfig:{ forceFit:true }, bbar: new Ext.PagingToolbar({ pageSize:4, store: store, displayInfo: true, displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条', emptyMsg: "没有记录", items:[{text:'请输入主号或SIM卡号:'},{xtype:'textfield',id:'contentStr'},'-','-', {text:'查询信息', handler:function(){ contentStr = Ext.get('contentStr').getValue(); //获取查询的信息值 webAction = "searchDevice"; //改变查询的参数 store.baseParams.webAction = webAction; //设置参数 store.baseParams.contentStr= contentStr; store.load({params:{start:0,limit:4,webAction:webAction,contentStr:contentStr}}); //加载数据 }},'-','-', { //iconCls:'remove', text:'删除信息', //handler:doDelete handler:function(){ var store = grid.getStore(); var thisColumn = grid.getSelectionModel(); var allColumn = thisColumn.getSelections(); var isNull=allColumn; //store.remove(allColumn) if(!isNull.length){ Ext.Msg.alert('提示信息','请选择要删除的数据,否则无法进行删除操作!'); return; }else{ var x = ""; for(var i=0;i<=allColumn.length-1;i++){ var record = store.getAt(i); var sim = record.get("SimID"); if(i<allColumn.length-1){ x += sim+','; } else{ x +=sim; } } Ext.Msg.confirm('提示信息','你确定要删除所选数据吗?',function(btn){ if(btn=="yes"){ Ext.MessageBox.wait("正在删除数据,请稍候......", "请稍侯"); Ext.Ajax.request({ url:'http://192.168.16.120/123/DataPage.aspx?webAction=deleteDeviceInfor&sim_card='+x, success:function(response){ Ext.Msg.alert('提示信息','数 据 删 除 成 功!'); var text = response.responseText; store.remove(allColumn); store.reload(); // store.getStore().reload(); }, failure:function() { alert('错误信息','连接失败,请稍候重试!'); } }) } }) }} },'-','-', {text:'刷新', handler:function(){ webAction = "firstLoadDeviceTree"; //改变查询的参数 store.baseParams.webAction = webAction; //设置参数 store.load({params:{start:0,limit:4,webAction:webAction}}); //加载数据 E