2012-05-11 59 views
0

我使用sencha touch來創建form.fieldset。在我的模型中,我有一個圖像字段,我該如何顯示模型的當前圖像?像我form.fieldset樣子:帶sencha觸摸的圖像字段

/** 
* This is used by the NestedList example to allow editing of an item in the Store 
*/ 
Ext.define('ParkingSencha.view.EditorPanel', { 
    extend: 'Ext.form.Panel', 
    requires: ['Ext.form.FieldSet'], 
    id: 'editorPanel', 
    config: { 
     modal: true, 
     hideOnMaskTap: false, 
     centered: true, 
     width: 500, 
     scrollable: false, 
     items: [{ 
      xtype: 'fieldset', 
      items: [ 
      { 
       xtype: 'textfield', 
       name: 'keyword', 
       label: 'Mots clés' 
      }, 
      { 
       xtype: 'textfield', 
       name: 'title', 
       label: 'Titre' 
      }, 
      { 
       xtype: 'textfield', 
       name: 'image', 
       label: 'image' 
      } 
      ] 
      }] 
     }] 
    } 
}); 
+0

你想你的圖像被加載到你的第三個文本區域? –

+0

你的圖像存儲在哪裏? –

+0

是的,我想加載它在第三個文本框。我的圖像存儲在我的服務器上。 – Sebastien

回答

0

對於使用/加載imageformfield,你需要使用image組件,而不是textfield

像這樣做,

.... 
{ 
    xtype: 'image', 
    src: 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png', 
    flex: 1 
}, 
.... 
+0

我不能,我想顯示我當前模型的圖像。它是一個編輯窗體... – Sebastien

+0

圖像內的文本框?這怎麼可能有意義呢? –

+0

使用圖像編輯模型時。你想要顯示當前圖像嗎?這就是我想要做的。我只是寫了textfield,因爲我不知道該用什麼。 – Sebastien

0

有這個另一種解決方案需要一個標籤,並設置圖像的HTML標記內.... :) 這樣

{ 
xtype:'label', 
html:'<img src="path of image ">' 
} 

或boomslang ans是不是正確的,我會建議你使用..