PDA

View Full Version : Store - transmit old vaues



dobberph
3 Nov 2013, 9:19 AM
Hello,

in an app I have a store in which the primary keys will have to be changed by the app.
Now, if I sync the store my php-script has no chance to update the entry in database because
it doesn't know about the original primary keys.
Is there a possibility to transmit the old values?

P.S.: `id_surrgoat` is not available on serverside. Its just a linennumber.
The real PRIMARY KEYs are login_id, product_id, start_date, end_date


Ext.define('Abonnement.model.Abonnement', { extend: 'Ext.data.Model',


fields: [
{
name: 'id_surrogate'
},
{
name: 'login_id',
type: 'int'
},
{
name: 'product_id',
type: 'int'
},
{
name: 'start_date'
},
{
name: 'end_date'
},
{
name: 'active',
type: 'boolean'
}
]
});

Ext.define('Abonnement.store.AbonnementStore', {
extend: 'Ext.data.Store',
alias: 'store.abonnementStore',


requires: [
'Abonnement.model.Abonnement'
],


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
model: 'Abonnement.model.Abonnement',
storeId: 'AbonnementStore',
pageSize: 12,
proxy: {
type: 'ajax',
idParam: 'id_surrogate',
url: 'pages/abonnement/testAbonnements.json',
reader: {
type: 'json',
idProperty: 'id_surrogate',
messageProperty: 'msg',
root: 'rows'
},
writer: {
type: 'json',
allowSingle: false,
root: 'rows'
}
}
}, cfg)]);
}
});

Thanks a lot,
Tobias

scottmartin
5 Nov 2013, 5:55 AM
Do your record key is a compound index? Build the id/key from the client values.


`id_surrgoat` is not available on serverside
Why would you do such a thing? :-?

Why not create an autoinc (or unique id) field and be one with it?

Scott.

dobberph
6 Nov 2013, 7:01 AM
Because in SQL I have the PRIMARY KEY {login_id, product_id, start_date, end_date}
Why should I create a new id for this? Its not nessacary.

But if there is no solution for this I will provide a unique single-id.

Thanks,
Tobias