Model Sencha Touch 2:模型中的转换功能修改存储中的记录

Model Sencha Touch 2:模型中的转换功能修改存储中的记录,model,sencha-touch,store,Model,Sencha Touch,Store,我已经创建了一个带有restproxy和一个使用PullRefreshPlugin的列表的存储。在我的模型中,我有一个datetimefield的转换函数。 当我通过插件刷新列表时,我的所有记录都修改了字段 我认为这是由我的模型中的convert函数引起的。 有什么办法可以避免吗 提前谢谢 编辑:代码片段 型号: Ext.define('MyApp.model.MyModel', { extend: 'Ext.data.Model', config: { fie

我已经创建了一个带有restproxy和一个使用PullRefreshPlugin的列表的存储。在我的模型中,我有一个datetimefield的转换函数。 当我通过插件刷新列表时,我的所有记录都修改了字段

我认为这是由我的模型中的convert函数引起的。 有什么办法可以避免吗

提前谢谢

编辑:代码片段

型号:

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');
                            }
                        }
                    }
                }
            }
        ]
    }
});
商店:

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'
            }
        }
    }
});
名单:


在我的控制器中,我正在使用store.sync

请提供您的代码片段。我完全忘记了我的代码,对此表示抱歉。
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'
        }]
    }
});