当前位置: 代码迷 >> JavaScript >> Extjs兑现多删除方法
  详细解决方案

Extjs兑现多删除方法

热度:111   发布时间:2012-07-19 16:02:20.0
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
??? ??? ??? });
??? ??? ?},

  相关解决方案