//获取选中多行数据
var rows = grid.getSelectionModel().getSelections();// 返回值为Record 数组
//获取选中单行数据
var _rd = grid.selModel.getSelected();//返回值为 一个record结果集
//获取所有编辑过的数据
var modifieds = grid.getStore().getModifiedRecords();
页面使用过程中完整代码:(仅供参考)
var modifieds = grid.getStore().getModifiedRecords();
var changerows = [];
for(vari=0;i<modifieds.length;i++){
changerows.push(modifieds[i].data);
}
if(changerows.length==0){
showInfoMsg("数据无修改,不做保存处理。");
return;
}
Ext.Ajax.request({
url:"*.jsp",
params:{datas:Ext.util.JSON.encode(changerows)},
success:function(){showInfoMsg("数据保存成功!");_store.commitChanges();},
failure:function(){showErrorMsg("保存数据时发生错误,保存失败!");}
});
//后台解析params
String datas =request.getParameter("datas");
JSONArray jSONObject = JSONArray.fromObject(datas);
Object[] os =jSONObject.toArray();
for(inti=0;i<os.length;i++){
JSONObjectjsonObj = JSONObject.fromObject(os[i]);
键值 = jsonObj.getString("键名");
}
实现多行删除 和编辑 ok!~~
extjs4多行选中
最新推荐文章于 2017-12-14 19:02:55 发布