在面板的tap處理程序上,我創建一個列表(使用itemTpl),然後用相關項目填充其存儲,然後將其設置到容器。當顯示此列表時,首先顯示的項目已完全顯示,並將其餘所有其他項目放在其下方,並相互重疊。這發生在90%的時間不總是,如果我調整瀏覽器或改變設備重疊的方向消失,所有項目看起來都適合。在大多數時間部分重疊的列表項目
這裏是我的商店:
var listStore = Ext.create('Ext.data.Store', {
fields: ['id','image','name','description']
});
這裏是我正在填充店:
var json = Ext.decode(response.responseText);
var arr = json.categories;
for(var x = 0; x < arr.length; x++) {
if(arr[x].id == self.parent.cid){
var itemsArr = arr[x].items;
var myitems = [];
for(var y = 0; y < itemsArr.length; y++) {
myitems.push({"id":itemsArr[y].id, "image":itemsArr[y].image, "name":itemsArr[y].name, "description":itemsArr[y].description});
}
listStore.add(myitems);
}
}
這裏是我正在創建列表:
var itemsList = {
xtype: 'list',
itemTpl : self.parent.tp,
store : listStore,
flex : 1,
id : 'ilid',
layout : 'fit',
templateId : 'detailsTemplate_'+self.parent.cid,
detailsView : 'myshop.view.'+self.parent.ctype+'Details',
direction: 'vertical',
listeners: {
itemtap: function (list, index, element, record)
{
var popup = Ext.create(list.detailsView, {
rec : record.getData(),
tid : list.templateId
});
Ext.Viewport.add(popup);
popup.show('pop');
}
}
};
這裏模板:
<tpl for="."><div class="tp_1"><div class="productBox"><div class="productTitle">{name}</div><div class="productBody"><img class="productImage" src="{image}"/></div></div></div></tpl>
這裏是如何看起來像:
請幫幫忙!
編輯! 這裏是模板:
<tpl for=".">
<div class="tp_5">
<div class="productBox">
<div class="productTitle">{name}</div>
<div class="productBody"><img class="productImage" src="{image}" width="300"/></div>
</div>
</div>
</tpl>
這裏是有關CSS:
.productBox
{
border:1px solid #9a9a9a;
}
.productTitle
{
border-bottom:1px solid #9a9a9a;
padding:5px 10px 0px 10px;
background-color:#ccc;
font-weight:bold;
font-size: 80%;
height:30px;
}
.productBody
{
padding:10px;
background-color: white;
}
.productImage
{
margin-left: auto;
margin-right: auto;
display: block;
}
.tp_5 .productBody, .st_5 {
background-color : white;
}
編輯
在測試各種東西一樣使用Flex,提供利潤率,做刷新等我意識到,這僅當列表首次加載時纔會發生重疊。當我回到主網頁,並從容器
hccontainer.remove(Ext.getCmp('ilid'), true);
刪除它,然後重新創建,並把它放在容器中的onTap事件,它呈現的罰款。
也有重疊只發生第二個項目,第一個項目總是顯示完整。
也告訴我們在你的模板中的HTML的CSS。 –
嘿TDeBailleul,我添加了模板和CSS。也感謝提醒我接受一些傑出的答案。 – ThinkFloyd