日期:2014-05-16  浏览次数:20442 次

Extjs实现多删除方法

?del:function(){
??? ??????? var record = this.getSelectionModel().getSelections();
??????????? if(record == null || record.length == 0){
??????????????? Ext.Msg.alert("提示","请选择要删除的表格行!");
??????????????? return false;
??????????? }
??????????? var ids = '';
??????????? for(var i = 0; i < record.length; i++){
??????????????? if(i == record.length - 1){
??????????????????? ids += record[i].get('pk_id');??
??????????????? }else{
??????????????????? ids += record[i].get('pk_id');??
??????????????????? ids += ',';
??????????????? }
??????????? }
??? ??? ???? Ext.Ajax.request({
??? ??? ??? ??? url : '<%=basePath%>UserServlet.do?method=del',
??? ??? ??? ??? method:'GET',
??? ??? ??? ??? callback : function(options,success,response){
??? ??? ??? ??? ??? var result = Ext.util.JSON.decode(response.responseText);
??? ??? ??? ??? ??? if(!result.success){
??? ??? ??? ??? ??? ??? Ext.Msg.show({
??? ??? ??? ??? ??? ??? ??? title : '错误提示',
??? ??? ??? ??? ??? ??? ??? msg : '删除记录失败!',
??? ??? ??? ??? ??? ??? ??? buttons : Ext.Msg.OK,
??? ??? ??? ??? ??? ??? ??? icon : Ext.Msg.ERROR
??? ??? ??? ??? ??? ??? });???
??? ??? ??? ??? ??? }
??? ??? ??? ??? ??? if(success){
??? ??? ??? ??? ??? ??? Ext.Msg.show({
??? ??? ??? ??? ??? ??? ??? title : '提示',
??? ??? ??? ??? ??? ??? ??? msg : '成功删除记录!',
??? ??? ??? ??? ??? ??? ??? buttons : Ext.Msg.OK
??? ??? ??? ??? ??? ??? });???
??? ??? ??? ??? ??? ??? this.refresh();
??? ??? ??? ??? ??? }
??? ??? ??? ??? },
??? ??? ??? ??? params : {
??? ??? ??? ??? ??? ids:ids
??? ??? ??? ??? },
??? ??? ??? ??? scope : this
??? ??? ??? });
??? ??? ?},