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 Sencha触摸同步商店_Extjs_Sencha Touch_Sencha Touch 2 - Fatal编程技术网

Extjs Sencha触摸同步商店

Extjs Sencha触摸同步商店,extjs,sencha-touch,sencha-touch-2,Extjs,Sencha Touch,Sencha Touch 2,我有两个存储区:localstorage和服务器上的一个json,我正在尝试将数据从json下载到本地存储区。请看有什么问题: /store/Notes.js Ext.define("NotesApp.store.Notes", { extend: "Ext.data.Store", requires: "Ext.data.proxy.LocalStorage", config: { storeId: 'Notes', model: "No

我有两个存储区:localstorage和服务器上的一个json,我正在尝试将数据从json下载到本地存储区。请看有什么问题:

/store/Notes.js

Ext.define("NotesApp.store.Notes", {
    extend: "Ext.data.Store",
    requires: "Ext.data.proxy.LocalStorage",
    config: {
        storeId: 'Notes',
        model: "NotesApp.model.Note",
        proxy: {
            type: 'localstorage',
            id: 'notes-app-store'
        },
        sorters: [{
            property: 'dateCreated',
            direction: 'DESC'
        }],
        grouper: {
            sortProperty: "dateCreated",
            direction: "DESC",
            groupFn: function (record) {

                if (record && record.data.dateCreated) {
                    return record.data.dateCreated.toDateString();
                } else {
                    return '';
                }
            }
        }
    }
});
/store/Online.js

Ext.define("NotesApp.store.Notes", {
    extend: "Ext.data.Store",
    requires: "Ext.data.proxy.LocalStorage",
    config: {
        storeId: 'Notes',
        model: "NotesApp.model.Note",
        proxy: {
            type: 'localstorage',
            id: 'notes-app-store'
        },
        sorters: [{
            property: 'dateCreated',
            direction: 'DESC'
        }],
        grouper: {
            sortProperty: "dateCreated",
            direction: "DESC",
            groupFn: function (record) {

                if (record && record.data.dateCreated) {
                    return record.data.dateCreated.toDateString();
                } else {
                    return '';
                }
            }
        }
    }
});
Ext.define(“NotesApp.store.Online”{ 扩展:“Ext.data.Store”, 配置:{

       storeId: 'Online',
       proxy: {
           type: 'jsonp',
           url: 'http://server.com/made/qa.php',
           reader: {
               type: 'json'
               //rootProperty: 'results'
           }
       },
       autoLoad: false,
       listeners: {
           load: function() {   
                console.log("updating");
               // Clear proxy from offline store
               Ext.getStore('Notes').proxy.clear();
               console.log("updating1");
               // Loop through records and fill the offline store
               this.each(function(record) {
                         console.log("updating2");
                         Ext.getStore('Notes').add(record.data);

               });

               // Sync the offline store
               Ext.getStore('Notes').sync();
               console.log("updating3");
               // Remove data from online store
               this.removeAll();
                console.log("updated");
           }

       },
       fields: [
                {
                name: 'id'
                },
                {
                name: 'date_created'
                },
                {
                name: 'question'
                },
                {
                name: 'answer'
                },
                {
                name: 'type'                    
                },
                {
                name: 'author'
                }
                ]
       } });
当我需要更新时,我调用了
Ext.getStore('Online').load();

但是控制台在“更新”之后没有显示任何其他内容

我想知道出了什么问题?

使用
Ext.getStore('Notes')。getProxy().clear()