架构师将存储同步到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();
}
相关文章:
- 在控制器和数据对象之间同步数据
- 同步调用,直到用户通过angular验证为访问者
- javascript函数同步
- 使用带有JavaScript的SOAP WebService
- 与运行长作业(javascript,node.js)的第三方API同步的最佳实践
- 显示具有服务器端自动时间注销的同步倒计时计时器
- 如何将Knockout.JS与服务器已经在DOM中呈现的数据同步
- 音频和动画在javasctipt循环中同步
- 主线程上的同步XMLHttpRequest已弃用
- 主干网.与Safari同步问题
- 失败:等待Protractor与页面同步时出错:“”;在窗口上找不到角度”;
- 是否同步加载了LINK元素
- 异步获取数据使用JavaScript同步获取数据
- 以同步方式获取Javascript Promise的值
- ajax调用获胜't同步执行
- javascript函数中的异步与同步.(Node.js)
- 如何同步写入process.stdout
- JavaScript 函数同步执行
- HTML5应用程序数据库同步
- 架构师将存储同步到WebService