Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
加载时,ExtJS模型原始数据未与实际记录同步_Extjs_Model_Store_Sync - Fatal编程技术网

加载时,ExtJS模型原始数据未与实际记录同步

加载时,ExtJS模型原始数据未与实际记录同步,extjs,model,store,sync,Extjs,Model,Store,Sync,我有一个模型 Ext.define('MyCompany.model.Customer', { extend: 'Ext.data.Model', fields: [ 'id', 'name', 'taxID', 'tradeID', 'vatID', 'email' ] } 还有一家商店 Ext.define('MyCompany.store.Customers', { extend: 'MyCompany.lib.base.Store',

我有一个模型

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

    fields: [
        'id', 'name', 'taxID', 'tradeID', 'vatID', 'email'
    ]
}
还有一家商店

Ext.define('MyCompany.store.Customers', {
    extend: 'MyCompany.lib.base.Store',

    model: 'MyCompany.model.Customer',

    api: {
        read: $["crmModule.CustomerController"].list,
        create: $["crmModule.CustomerController"].save
    }
});
问题在于,例如从控制台调用store.load时,字段vatID未同步。我可以在store.data.items[0]中看到该字段。原始字段,但在store.data.items[0]中看到。数据字段为空。如何调试此问题?ExtJS在哪里将原始数据转换为实际记录?

查找为Ext.data.reader.reader定义的名为extractData的方法。有以下几行:

// If the server did not include an id in the response data, the Model constructor will mark the record as phantom.
// We  need to set phantom to false here because records created from a server response using a reader by definition are not phantom records.
record.phantom = false;

// Use generated function to extract all fields at once
me.convertRecordData(convertedValues, node, record);

records.push(record);
当您进入convertRecordData方法时,将显示生成的用于实际转换的临时代码,如下所示:

return function(dest, source, record) {
    value = source["id"];
    if (value !== undefined) {
        dest["id"] = value;
    }
    value = source["name"];
    if (value === undefined) {
        if (me.applyDefaults) {
    ...