Balduran
4 Jul 2012, 5:38 AM
Hi
I am quite new to ext js and have run into a problem.
I have a very simple user grid from where you can create new user entry to datastore. Everything seems to work, create query is sent to database, but after that there is a "user" in store that id is null.
Create query json:
{"data":[{"id":null,"name":"test","email":"test@test.ee"}]}
Create query response is:
{"data":[{"id":9}],"success":true}
(have tried different variations, like data is single element, returning all fields etc, but nothing has worked).
I think ext js should handle this automatically, that record id gets updated after create response is received, but I can't seem to get it working.
So the data store:
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
autoSync: true,
pageSize: 4,
proxy: {
type: 'ajax',
api: {
create: 'data/users.php?action=create',
read: 'data/users.php?action=read',
update: 'data/users.php?action=update',
destroy: 'data/users.php?action=delete'
},
reader: {
type: 'json',
root: 'users',
successProperty: 'success',
totalProperty: 'total',
},
writer: {
type: 'json',
root: 'data',
writeAllFields: false,
allowSingle: false,
}
}
});
I tried debugging through the extjs-all-debug, but it got a bit too comlicated to understand where this event could be...
Please help :)
I am quite new to ext js and have run into a problem.
I have a very simple user grid from where you can create new user entry to datastore. Everything seems to work, create query is sent to database, but after that there is a "user" in store that id is null.
Create query json:
{"data":[{"id":null,"name":"test","email":"test@test.ee"}]}
Create query response is:
{"data":[{"id":9}],"success":true}
(have tried different variations, like data is single element, returning all fields etc, but nothing has worked).
I think ext js should handle this automatically, that record id gets updated after create response is received, but I can't seem to get it working.
So the data store:
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
autoSync: true,
pageSize: 4,
proxy: {
type: 'ajax',
api: {
create: 'data/users.php?action=create',
read: 'data/users.php?action=read',
update: 'data/users.php?action=update',
destroy: 'data/users.php?action=delete'
},
reader: {
type: 'json',
root: 'users',
successProperty: 'success',
totalProperty: 'total',
},
writer: {
type: 'json',
root: 'data',
writeAllFields: false,
allowSingle: false,
}
}
});
I tried debugging through the extjs-all-debug, but it got a bit too comlicated to understand where this event could be...
Please help :)