0

ExtJS 3.4 を使用しており、アプリケーションで fileupload を使用したいと考えています。私のコードとファイルアップロードフィールドのスクリーンショットを以下に示します。fileupload フィールドの表示に問題があり、このエラーを解決できませんでした。誰でも助けることができますか?

ここに画像の説明を入力

var uploadFormPanel = new Ext.FormPanel({
    fileUpload  : true,
    autoHeight  : true,
    height      : 200,
    bodyStyle   : 'padding: 10px 10px 0 10px;',
    labelWidth  : 50,
    defaults    : {
        anchor      : '95%',
        allowBlank  : false,
        msgTarget   : 'side'
    },
    items: [
            {
                xtype           : 'combo',
                fields          : ['id','name'],
                name            : 'fuelCompany',
                store           : comboStore,
                valueField      : 'id',
                displayField    : 'name',
                submitValue     : true,
                typeAhead       : true,
                triggerAction   : 'all',
                selectOnFocus   : true,
                allowBlank      : false,
                mode            : 'remote',
                anchor          : '95%'
            },{
                xtype       : 'fileuploadfield',
                id          : 'form-file',
                name        : 'file',
                buttonText  : 'select file',
                buttonCfg   : {
                    iconCls : 'upload-icon'
                }
            }
    ]
});
4

2 に答える 2

1

少しトリッキーですが、テキストを表示するボタンを取得する方法を理解したと思います。

//...
{
    xtype       : 'fileuploadfield',
    id          : 'form-file',
    name        : 'file',
    buttonCfg   : {
        text    : 'select file'
    }
}
//...

buttonCfgボタンのサイズを正しくするには、ボタン テキストを に配置する必要があります。唯一の欠点はiconCls、ボタンのサイズを自動的に変更したい場合、ボタンに を追加できないことです。別の方法として、ちょっとした回避策を使用できます。

//...
{
    xtype       : 'fileuploadfield',
    id          : 'form-file',
    name        : 'file',
    buttonCfg   : {
        // The text cfg takes html too
        text    : '<div class="upload-icon"' +
                  ' style="width: 15px; height: 15px; display: inline-block;' +
                  ' margin: 0 5px;"></div>' +
                  'select file'
    }
}
//...
于 2013-03-31T22:40:44.020 に答える
0

css ファイルに到達できません。JavaScript コードで問題が解決したと定義されている jsp ファイルに css スタイルを配置しました。

于 2013-04-15T20:30:48.903 に答える