mardi 20 janvier 2015

How to modify data after load and before save in store?

I want to add some properties to all records after they are loaded from server.

Code:



Ext.define('Dms.proxy.CustomRestProxy', {


alias: 'proxy.customRest',


extend: 'Ext.data.proxy.Rest',


afterRequest: function(request, success) {
var records = request.getRecords();
var jsonData = request.getJsonData();


request.setRecords(records);
request.setJsonData(jsonData);
}
});

Ext.define('DocItemTree', {
extend: 'Ext.data.Model',


idProperty: 'Id',


fields: [
{ name: 'Id', type: 'string' },
{ name: 'Name', type: 'string' }
],


proxy: {
type: 'customRest',
url: '/api-ci/DocItemTree',
// Use extra parameter to get only items which are corresponding to actual entity
extraParams: {
Entity: Dms.config.Runtime.getEntityFromUrl(),
EntityType: Dms.config.Runtime.getEntityTypeFromUrl()
}
}
});

I have tried it with a custom proxy, but the getRecords() function and the getJsonData() function are returning no data



How to modify data after load and before save in store?

Aucun commentaire:

Enregistrer un commentaire