[英]Sencha Touch: How to create a list in an hbox Panel
我有一個導航視圖,其中包含一個tabview,在其中我想添加一個hcot面板,該面板包含cotnains和list,另一個面板並排放置。 但是,當我嘗試將列表添加到面板時,沒有任何顯示。 我想知道如何做到這一點 導航視圖
Ext.define('MyApp.view.Navigation', {
extend: 'Ext.navigation.View',
id: 'NavView',
xtype: 'navigationcard',
onBackButtonTap: function () {
//if on forms screen and button is visible remove add form button
var self = Ext.getCmp('NavView');
var naviBtn = Ext.getCmp('addNewFormBtn');
if (naviBtn != null) {
naviBtn.hide();
}
self.pop();
},
config: {
title: 'Schedule',
iconCls: 'settings',
navigationBar: {
items: [{
xtype: 'button',
text: 'Add New Form',
align: 'right',
id: 'addNewFormBtn',
hidden: true,
handler: function () {
}
}]
},
//we only give it one item by default, which will be the only item in the 'stack' when it loads
items: [
{
xtype: 'mainview'
}
]
}
});
標簽面板
Ext.define('MyApp.view.Main', {
extend: 'Ext.TabPanel',
xtype: ['mainview', 'widget.mainview'],
config: {
title:'MyApp',
fullscreen: true,
tabBarPosition: 'bottom',
defaults: {
styleHtmlContent: true
},
items: [
contain ,
{ xtype: 'settingscard' }
]
}
});
帶有Hbox和列表的面板
var testData = [];
for (var i = 0; i < 40; i++)
{ testData.push({ txt: "test" }); }
var storesdasd = Ext.create('Ext.data.Store', {
data: testData
});
var contain = Ext.create('Ext.Panel', {
fullscreen: true,
layout: 'hbox',
title: 'Schedules',
iconCls: 'time',
items: [{
xtype: 'list',
itemTpl: '{txt}',
store: storesdasd,
flex: 1,
height: 'auto'
}
, {
html: 'message preview',
style: 'background-color: #759E60;',
flex: 2,
height: '100'
}],
config: {
title: 'Schedules',
iconCls: 'time'
}
});
而不是將所有這些片段分開放在不同的文件中,我將它們放在Ext.application
的啟動功能中,盡管似乎不確定為什么,但這似乎已經奏效。
采用:
layout: {
type: 'hbox',
align: 'stretch'
}
刪除子項上的高度配置。 同時刪除包含面板上的全屏配置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.