I'm having issues with a REST store.
STORE
REST-store performs un-wanted POST's on init.
It's configured with autoSync: true and performs unexpected and unwanted POST and PUT-operations.
When my application loads, the store loads and begins with firing a POST with empty data after that it loads the backend data.
With autoSync: false in starts up like expected, ie no POST-operation.
Why does this happen?
The store is empty and the record it's trying to sync back doesn't even exists!
Screen Shot 2014-12-20 at 17.30.41.png
Screen Shot 2014-12-20 at 17.31.47.png
MODEL
Code:
Ext.define('Archive.model.Directory', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.Integer',
'Ext.data.field.String',
'Ext.data.field.Boolean',
'Ext.data.proxy.Rest',
'Ext.data.reader.Json',
'Ext.data.writer.Json'
],
fields: [
{
type: 'int',
name: 'id'
},
{
type: 'string',
name: 'name'
},
{
type: 'int',
name: 'games'
},
{
type: 'boolean',
name: 'leaf'
}
],
hasMany: {
model: 'Archive.model.Directory',
name: 'children'
},
proxy: {
type: 'rest',
extraParams: {
otype: 'user',
oid: 1
},
url: '/api/v1/archive/directory.php',
appendId: false,
reader: {
type: 'json',
rootProperty: 'data'
},
writer: {
type: 'json'
}
}
});
STORE
Code:
Ext.define('Archive.store.Directory', {
extend: 'Ext.data.TreeStore',
requires: [
'Archive.model.Directory'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'Directory',
autoLoad: true,
autoSync: true,
model: 'Archive.model.Directory'
}, cfg)]);
}
});
REST-store performs un-wanted POST's on init.
Aucun commentaire:
Enregistrer un commentaire