新学Extjs,做一个表单的CRUD,看到网上有介绍rowEditing插件的就想尝试着用用,但是在startEdit(0,0)这句上会报错,提示Uncaught TypeError: Object 0 has no method 'get' 不知道是什么原因,希望能有人帮忙解释一下。附上grid,store,model,controller的部分代码。
希望大家能不吝赐教。
grid:
plugins: [ Ext.create('Ext.grid.plugin.RowEditing', {
pluginId:'rowEditing',
saveBtnText: '保存',
cancelBtnText: "取消",
clicksToEdit: 1
}) ],
store:
Ext.define("staffManagement.store.staffStore",{
extend:"Ext.data.Store",
model:"staffManagement.model.staffModel",
pageSize:4,
proxy:{
type:"ajax",
waitMsg : '数据加载中...',
url:"/SSH/js/loadAllStaffAction.action",
/*url:"/SSH/js/test.json",*/
reader:{
type:"json",
root:"list",
totalProperty :'totalCount'
},
writer:{
type:"json"
}
},
autoLoad:true
});
model:
Ext.define("staffManagement.model.staffModel",{
extend:"Ext.data.Model",
fields:[
{name:"userId",type:"int",srotable:true},
{name:"name",type:"string",srotable:true},
{name:"userPassword",type:"string",srotable:true},
{name:"sex",type:"string",srotable:true},
{name:"birthday",type:"date",srotable:true}
]
});
controller:
Ext.define("staffManagement.controller.staffController", {
extend : "Ext.app.Controller",
init : function() {
this.getGrid = function(button) {
return button.ownerCt.ownerCt;
};
this.control({
"staffGrid button[id=add]" : {
click : function(button) {
var store = Ext.getStore('staffStore');
var adminObj = Ext.create('staffManagement.model.staffModel',{});
store.insert(0,adminObj);
var rowEditing = Ext.getCmp('staffGrid').editingPlugin;
rowEditing.startEdit(0,0);
}
},