ExtJS 4.1。
让我们假设我们有一些形式:
Ext.define('App.view.editform', {
extend: 'Ext.form.Basic',
defaultType: 'textfield',
items: [
{
fieldLabel: 'Title',
name: 'title',
allowBlank: false,
}, {
xtype: 'textarea',
fieldLabel: 'Text',
name: 'text',
height: 160,
}, {
xtype: 'filefield',
fieldLabel: 'Image',
name: 'image',
}, {
xtype: 'hidden',
name: 'id',
},
],
});
和商店:
Ext.define('App.store.Store', {
extend: 'Ext.data.Store',
model: new Ext.data.Model({
fields: [
{name: 'id', type: 'int'},
{name: 'title', type: 'string'},
{name: 'text', type: 'string'},
],
proxy: {
type: 'ajax',
url: '/someurl',
reader: {
type: 'json',
root: 'results'
},
},
}),
autoLoad: true,
autoSync: true,
});
要修改Records
中的Store
,我们可以在表单和loadRecord();
方法上使用updateRecord();
方法将更改提交到Store
(然后再提交给服务器) 。但是在服务器上,每个Record
都有与之关联的图像。
updateRecord();
方法仅向Store
提交文本字段。 Model
不能包含binary
类型字段。
那么有没有办法使用表单updateRecord();
方法上传图片?
答案 0 :(得分:0)
没有。在服务器端必须有这个特殊的处理程序。