var editor = new Ext.ux.grid.RowEditor({
saveText : '更新',
cancelText : '取消',
clicksToEdit : 2
});
var grid = new Ext.grid.GridPanel({
id: 'grid',
region: 'center',
autoWidth: true,
。。。
plugins: [editor]
});
grid.addListener('rowclick', function(obj, rowIndex, columnIndex, e){
var record = grid.getStore().getAt(rowIndex);
id = record.get('roleid');
}, this);
editor.on({
scope : this,
beforeedit : function (roweditor, rowIndex){
var roleid = grid.getStore().getAt(rowIndex).get('roleid');
if(roleid == 10){
return false;
}else{
return true;
}
},
afteredit : function(roweditor, changes, record, rowIndex) {
Ext.Ajax.request({
url: '${contextPath}/project/manage/edit/userAction.do?action=updateRole&'&userid=' + userid + '&roleid=' + roleid + '&t=' + Math.random(),
success:function(response){
if(response.responseText.trim()=="true"){
id = null;
Ext.MessageBox.alert('提示',"修改成功!",function(){
store.reload();
});
}else{
Ext.MessageBox.alert('提示',response.responseText);
store.reload();
}
},
failure:function(){Ext.MessageBox.alert('提示',"系统有误!");}
});
}
});
?
? ? 当双击角色列是会提示this.items is undefined
? ? 经查找问题处在beforeedit 中,RowEditer.js使用的版本是3.0.0,官方网站上说此版本存在此BUG。
?
? ? 使用3.4.0版本的替换此版本,问题解决。
?
?