代码事例3

taoexpo.user.userManage.deleteUser = function(dataStore, grid) {
 
 var records = grid.getSelectionModel().getSelections();
 if (records != null && records != '') {
  Ext.MessageBox.confirm('提示', '确定要删除所选记录?', function(btn) {
     if (btn == 'yes') {
      var strIds="";
      for (var i = 0; i < records.length; i++) {
       if (i == 0) {
        strIds = strIds+records[i].get('staffId');
       } else {
        strIds = strIds+","+records[i].get('staffId');
       }
      }
      Ext.Ajax.request({
         url : getContextPath()+'/deleteUser.htm',
         params : {
          'staffids' : strIds
         },
         success : function(data) {
          var obj = Ext.util.JSON
            .decode(data.responseText);
          if (obj.success) {
           dataStore.load({
              params : {
               start : 0,
               limit : 20
              }
             });
           Ext.MessageBox
             .alert('提示', '数据删除成功!');
          } else {
           Ext.MessageBox
           .alert('提示','数据删除失败!');
          }
         },
         failure : function(data) {
          Ext.MessageBox
          .alert('提示','数据删除失败!');
         }
        });

     }
    });

 } else {
  Ext.MessageBox
  .alert('提示', "请至少选择一条记录!");
 }

 
};

你可能感兴趣的:(代码事例3)