0

ExtJS4.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();StoreRecord

updateRecord();メソッドは、テキストフィールドのみをに送信しますStore。タイプフィールドModelを含めることはできません。binary

では、formsメソッドを使用して画像をアップロードする方法はありupdateRecord();ますか?

4

1 に答える 1

0

いいえ。サーバー側でこれのための特別なハンドラーが必要です。

于 2012-07-10T13:52:36.250 に答える