2011-05-23 49 views
1

我嘗試添加一個圖像到面板的背景。該圖像來自加載的數據。 我嘗試下面的代碼,它沒有工作:sencha touch ::添加一個背景圖像到面板

var topPanel = new Ext.Panel({ 
     flex:1, 
     title:'topPanel', 
     style:'style="background-image: url('+this.jsonData.picURL+');' 

}); 

,當我創建工作的偉大與「itemTpl」列表。

我還試圖

style:'background-image: url({picURL});' 

連同

store: { 
      fields: ['firstName','lastName', 'picURL'], 
      data: this.jsondData 
     } 

但然後我得到的消息

[[對象的對象]]不是有效 論據 ' Function.prototype.apply的」。

任何想法可以幫助! 日Thnx

+0

我現在生活在一個解決方法中,把圖像放在「html」屬性中。 – headkit 2011-05-24 08:48:18

回答

5

您可以到面板的樣式屬性分配對象添加自定義樣式

style: { 
      backgroundImage: 'url(resources/branding/mobile.gif)', 
      backgroundRepeat: 'no-repeat', 
      backgroundPosition: 'center' 
} 
3

,如果你想覆蓋整個背景使用:

backgroundSize:「蓋」

相關問題