Extjs怎么删除Grid的记录

下面代码是Ext.grid.GridPanel 的一个tbar的Ext.Button提交删除:
   1:  tbar : [new Ext.Button ({allowDepress : false,
   2:          handler : function() {NewHall();},
   3:          iconCls : 'add',
   4:          text : '新增'
   5:      })
   6:  ,            
   7:  new Ext.Button ({allowDepress : false,
   8:          handler : function() {
   9:          Ext.MessageBox.confirm('提示', '确实要删除所选的记录吗?',function (btn){
  10:          if(btn=='yes'){           
  11:          var row=extWindowDepartmentList.getSelections();           
  12:          var jsonData="";           
  13:          for(var i=0,len=row.length;i<len;i++){             
  14:          var ss = row[i].get("Id"); //这里为Grid数据源的Id列           
  15:          if(i==0)              
  16:          jsonData = jsonData + ss;                    
  17:          else              
  18:          jsonData = jsonData + ","+ ss;             }          
  19:          var conn = new Ext.data.Connection();          
  20:          conn.request(
  21:          {          url: "/Department/Del",        //提交的删除地址   
  22:          params:{strProjects:jsonData},            
  23:          method: 'post',            
  24:          scope: this,            
  25:          callback:function(options,success, response){            
  26:          if(success){                
  27:          Ext.MessageBox.alert("提示","所选记录成功删除!");
  28:          extWindowDepartmentList.store.reload({params:{start:0, limit:25}}); //重新load数据
  29:          }
  30:          else
  31:          {Ext.MessageBox.alert("提示","所选记录删除失败!");}
  32:          }
  33:          }) 
  34:          } 
  35:          })
  36:          ;},
  37:          iconCls : 'del',
  38:          text : '删除'
  39:      })
  40:  ]

你可能感兴趣的:(ExtJs)