PDA

View Full Version : illegal token in Ext.create



rnel
2 Nov 2012, 2:48 AM
hi,

I have an illegal token exception for this code (using a Ex.create in an Ext.define statement):


store : Ext.create('Ext.dtp.pdw.stores.User', {
storeId : 'usersStore',
autoLoad : true,
proxy : {
type : 'ajax',
url : 'users',
model : 'Ext.dtp.pdw.models.User',
reader : {
type : 'json',
root : 'users',
idProperty : 'id'
},
api : {
destroy : 'users/delete',
read : 'users',
update : 'users/update',
create : 'users/create'
}

}
}),

i have that error right after adding the


proxy : {
type : 'ajax',
url : 'users',
model : 'Ext.dtp.pdw.models.User',
reader : {
type : 'json',
root : 'users',
idProperty : 'id'
},
api : {
destroy : 'users/delete',
read : 'users',
update : 'users/update',
create : 'users/create'
}

}
as property in the create statement, i ddin't have thet error before. So, guys, what's the matter ? thanks.

Farish
2 Nov 2012, 3:38 AM
it could be because of the model config. The model config should be part of the store and not the proxy. try this:



store : Ext.create('Ext.dtp.pdw.stores.User', {
storeId : 'usersStore',
model : 'Ext.dtp.pdw.models.User',
autoLoad : true,
proxy : {
type : 'ajax',
url : 'users',
model : 'Ext.dtp.pdw.models.User',
reader : {
type : 'json',
root : 'users',
idProperty : 'id'
},
api : {
destroy : 'users/delete',
read : 'users',
update : 'users/update',
create : 'users/create'
}
}
}),

rnel
2 Nov 2012, 5:04 AM
No, it seems not, but thanks anyway, i've finally defined the proxy in the store class (my other ticket on the forum), and i works now.