我對Sencha非常陌生,我試圖在Panel中的DataView下獲得按鈕。我嘗試過不同的場景。Sencha - 將DataView與按鈕組合在同一視圖中
觀
Ext.define('MyApp.view.Profile', {
extend : 'Ext.Panel',
xtype : 'profileview',
requires : ['MyApp.store.UserStore', 'Ext.List', 'Ext.DataView', 'Ext.data.Store'],
initialize : function() {
var me = this;
var record = 1;
//Create the instance of the store and load it
var userStore = Ext.create('MyApp.store.UserStore');
userStore.load();
//Create the dataview
var view = Ext.create('Ext.DataView', {
store : userStore,
itemTpl : ['<h1>Mijn Profiel</h1>', '<h2>{USERNAME}</h2>', '<p>{EMAIL}</p><br/>', '<img src="http://www.MyApp.nl/{AVATAR_PATH}" />', '<br/>'].join()
});
//Add the dataview to the panel
me.add(view);
/**
var button = Ext.create('Ext.Button', {
text : 'Edit',
handler : function() {
Ext.Msg.alert('You clicked the button');
}
});
*/
//me.add(button);
},
config : {
title : 'Profiel',
iconCls : 'user3',
scrollable : true,
styleHtmlContent : true,
items : [{
xtype : 'button',
text : 'Edit',
handler : function() {
Ext.Msg.alert('You clicked the button');
}
}]
}
});
上面視圖僅示出了按鈕,但不是數據視圖。我需要添加
layout : 'fit'
到配置使它顯示DataView。但與按鈕組合使按鈕全屏,數據視圖不再顯示(???)。
我試了兩種情況下,我添加一個按鈕作爲配置項目,並通過使用處理程序。
如何獲得數據視圖下方的按鈕?
感謝您的幫助。
嘗試給底部:「10px的」以按鈕,讓我知道 – 1Mayur 2013-02-28 10:46:51
沒有工作,所以我加了一個高度屬性設置按鈕,現在我看到了,但按鈕位於頂部並覆蓋數據視圖(??) – 2013-02-28 11:28:12