I've created a store with a restproxy and a list which is using the PullRefreshPlugin. In my model I have a convert function for a datetimefield. When I refresh my list (via plugin) all my records have modified fields.
I think this is caused by the convert function in my model. Is there any way to avoid it?
Thanks in advance
Edit: Codesnippet
Model:
Ext.define('MyApp.model.MyModel', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'dateTimeField',
type: 'string',
convert: function (value) {
if (value) {
if (Ext.isDate(value)) {
return Ext.util.Format.date(value, 'c');
} else if (Ext.isString(value)) {
var match = value.match(/(.+)\[.+\]/);
if (match && match[1]) {
return Ext.Date.parse(match[1], 'c');
}
}
}
}
}
]
}
});
Store:
Ext.define('MyApp.store.MyStore', {
extend: 'Ext.data.Store',
requires: ['Ext.data.proxy.Rest'],
config: {
model: 'MyApp.model.MyModel',
proxy: {
type: 'rest',
url: '/path/to/items',
reader: {
rootProperty: 'root',
totalProperty: 'totalElements'
}
}
}
});
List:
Ext.define('MyApp.view.MyList', {
extend: 'Ext.dataview.List',
requires: ['Ext.plugin.ListPaging', 'Ext.plugin.PullRefresh'],
config: {
// config stuff..
plugins: [{
xclass: 'Ext.plugin.ListPaging',
autoPaging: true
}, {
xclass: 'Ext.plugin.PullRefresh',
lastUpdatedDateFormat: 'd.m.Y, H:i:s'
}]
}
});
In my controller I'm just using store.sync()