View Full Version : Grid with sync : url not defined OR listener broken

1 Sep 2011, 12:34 AM
I have the following store:

Ext.define('OverviewStore', {
extend: 'Ext.data.Store',
model: 'OverviewModel',
storeId: 'OverviewStore',

pageSize: 200,
buffered: true,
autoSync: true,

proxy: {
batchActions: true,
type: 'ajax',
// api: {
// read: 'controller/CtrlMsgsKey.php',
// update: ''
// },
url: 'controller/CtrlMsgsKey.php',
extraParams: {
action: 'load',
lang: 'de',
userid: _USERID
writer: {
type: 'json',
writeAllFields: false,
root: 'data'
reader: {
type: 'json',
root: 'results',
successProperty: 'success',
totalProperty: 'total'
listeners: {
beforeload: function(store) {
store.getProxy().extraParams.action = 'load';
beforesync: function(hash) {
Ext.getStore('OverviewStore').getProxy().extraParams.action = 'update';

I want to use a writer like in this example:

As you can see it very similar but i had two problems:
At first i tried to use the api config with update and read url. this does not work because i get an "url not defined" error.
than i thought "set the url and use the listeners" but that also not work because the "beforeload"-listeners get very strange arguments when its called.
the first arguments, that either should be the store is the listeners object of that store.

the other thing is that always all records are submitted on update, but i set

writeAllFields: false

any idea?

1 Sep 2011, 3:46 AM
after triing around i found out that the reason for the problem described above was, that my store set "phantom=true" for every record. that intended that every record was marked as "new".

but now there is the next problem:

after i edit something the red triangle in the corner of the changed field does not hide but the request returns success: true.

the reason for this is, that the record is marked as dirty i think but why this is not changed?

any idea on that?