form.submit可以成功运行并保存数据,但store.save没有。我在form.submit之外尝试了store.save并且它工作正常,但它需要在内部,因为我需要从响应中获取id。
这是代码:
form.submit({
success: function (form, response) {
var id = Ext.decode(response.response.responseText).id;
if (store.getUpdatedRecords().length > 0) {
var records = store.getRange();
Ext.each(records, function (record) {
record.data.businessCategoryId = id;
});
store.save();
}
}
});
这是我的viewModel,包括商店:
Ext.define('CustomFit.view.baseData.category.upsert.translations.TranslationsModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.categoryUpsertTranslations',
stores: {
translations: {
proxy: {
type: 'ajax',
reader: {
type: 'json',
rootProperty: 'data'
},
api: {
read: '../api/language/categorytranslations',
update: '../api/language/categorytranslations/save'
},
writer: {
encode: false,
writeAllFields: true,
allowSingle: false
}
}
}
}
});
由于某种原因,请求被中止了? This is a screenshot of the network showing the request being aborted.
为什么会发生这种情况或者我是否遗漏了什么?