PDA

View Full Version : Cannot access store



phamtranquocviet
17 Mar 2012, 2:02 PM
Hi,

I encounter a weird issue in one of my views. If I use the line in blue, it works. However, when I use the line in red, it gives the following error. I need the line in red to work.

c is not a constructor
....instantiators[length] = new Function('c', 'a', 'return new c('+args.join(',')+'....

I copy User.js from "store" folder to "iip/adm/" folder. So, they are identical. I went to my windows explorer to copy the path into the red line. So, wrong path possibility is eliminated. Please help.



.....
initComponent: function(){
Ext.apply(this, {
items: [
{html: ""}, this.createUserGrid(), {html: ""},
this.createRoleGrid(), this.createWorkspaceGrid(), this.createPrivGrid(),
{html: ""}, this.createResGrid(), {html: ""}
]
});
this.callParent(arguments);
},

createUserGrid: function() {
return Ext.create("Ext.grid.Panel", {
title: "Users",
store: Ext.create("Iip.store.User"),
//store: Ext.create("Iip.store.iip.adm.User"),
selType: "rowmodel",
id: "acl-tab-user-grid",
columns: [
{ header: "Name", dataIndex: "name" },
{ header: "Email", dataIndex: "email", flex: 1 },
{ header: "Phone", dataIndex: "phone" }
],
height: this.config.gridHeight,
width: this.config.gridWidth
});
}
....

phamtranquocviet
17 Mar 2012, 2:13 PM
I got it. I copied store/User.js to store/iip/adm/User.js. However, the declaration of my User.js class was still this:



Ext.define("Iip.store.User", {
extend: "Ext.data.Store",
storeId:"user-store",
.....
.....
});


Should be this:


Ext.define("Iip.store.iip.adm.User", {
extend: "Ext.data.Store",
storeId:"user-store",
.....
.....
});

vela1606
18 Mar 2012, 1:13 PM
Yeap you got it :-)