Di Peng
1 Dec 2011, 5:07 PM
Hi, following pseudocode illustrates the problem/bug I am having:
I have a store called 'myStore'
myStore.load() => loads 2 records from backend through a read operation.
myStore.sync() => I would expect nothing happens as I did not do anything with the store data. However, both records I just loaded got sent back to the backend as a create operation.
Following code snippet will reproduce the bug:
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'}
]});
var myStore = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
api: {
create : 'backend/create.php',
read : 'backend/read.php',
update : 'backend/update.php',
destroy : 'backend/destroy.php'
},
reader: {
type: 'json',
root: 'users'
}
}
});
//Keep network inspector open when executing the following lines
myStore.load() // goes to 'backend/read.php'
myStore.sync() // same records that just got loaded goes to 'backend/create.php'
This bug was produced on the latest stable Chrome
Thanks
Di
I have a store called 'myStore'
myStore.load() => loads 2 records from backend through a read operation.
myStore.sync() => I would expect nothing happens as I did not do anything with the store data. However, both records I just loaded got sent back to the backend as a create operation.
Following code snippet will reproduce the bug:
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'}
]});
var myStore = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
api: {
create : 'backend/create.php',
read : 'backend/read.php',
update : 'backend/update.php',
destroy : 'backend/destroy.php'
},
reader: {
type: 'json',
root: 'users'
}
}
});
//Keep network inspector open when executing the following lines
myStore.load() // goes to 'backend/read.php'
myStore.sync() // same records that just got loaded goes to 'backend/create.php'
This bug was produced on the latest stable Chrome
Thanks
Di