簡體   English   中英

Architect將商店同步到WebService

[英]Architect sync Store to WebService

我想將已在表單的某些字段中編輯的設置同步到服務器。

Firebug顯示:沒有,單擊按鈕時沒有連接。
JavaScript控制台顯示:沒有錯誤。

我有的:

onButtonClick: function(button, e, eOpts) {
    Ext.getStore("optionsStore").getAt(0).setDirty();
    Ext.getStore("optionsStore").commitChanges();
    Ext.getStore("optionsStore").sync();
}

我用來加載:

onJsonstoreLoad: function(store, records, successful, eOpts) {
    Ext.getCmp("optionsForm").getForm().loadRecord(store.getAt(0));
}

我的商店是由建築師建造的:

constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
        autoLoad: true,
        model: 'optionsModel',
        storeId: 'optionsStore',
        proxy: {
            type: 'ajax',
            api: 'read: \'http://localhost:52699/api/AdminPanel?do=select\',\r\ncreate: \'http://localhost:52699/api/AdminPanel?do=insert\',\r\nupdate: \'http://localhost:52699/api/AdminPanel?do=update\',\r\ndestroy: \'http://localhost:52699/api/AdminPanel?do=delete\'',
            url: 'allSettings.json',
            reader: {
                type: 'json',
                root: 'globalSettings'
            },
            writer: {
                type: 'json',
                allowSingle: false,
                encode: true,
                root: 'globalSettings'
            }
        },
        listeners: {
            load: {
                fn: me.onJsonstoreLoad,
                scope: me
            }
        }
    }, cfg)]);
},

這很簡單:

onButtonClick: function(button, e, eOpts) {
    Ext.getCmp("optionsForm").getForm().updateRecord(Ext.getStore("optionsStore").getAt(0));
    Ext.getStore("optionsStore").getAt(0).setDirty();
    Ext.getStore("optionsStore").commitChanges();
    Ext.getStore("optionsStore").sync();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM