[英]Sencha pop over on list itemtap
在我的應用程序中,我有一個列表。 我想在點擊項目時顯示彈出(疊加)。 它適用於某些項目,但對於某些項目,疊加層會直接進入列表項目。
注意:我想顯示帶有指向當前所選項目的箭頭的疊加層。 這是我的代碼:
var overlay = new Ext.Panel({
floating: true,
modal: true,
width: 100,
height: 100,
scroll: false});
var list = Ext.extend(Ext.List, {
store: myStore,
itemTpl: "{firstName} {lastName}",
listeners: {
itemtap: function (list, index, element, event) {
// Grab a reference the record.
var record = list.getRecord(element);
// First, we update the the overlay with the proper record (data binding).
overlay.update(record.data);
overlay.showBy(element, 'fade');
list.doComponentLayout();
}
}});
問題可能是我沒有正確獲取列表項。 我剛剛在這里使用了當前元素。 我也嘗試過list.getNode(index),但它做了同樣的事情。 任何人都可以指導我正確的方向嗎?
塔倫。
只需在函數中添加false
即overlay.showBy(element, 'fade',false);
http://docs.sencha.com/touch/1-1/#!/api/Ext.Panel-method-showBy
這是我的面板代碼。
var overlay = new Ext.Panel({
// We'll set the image src attribute's value programmatically.
//dock:'left',
floating: true,
modal: true,
width: 138,
height: 140,
scroll: false,
layout: {
type: 'vbox',
align:'center',
pack:'center'
},
//defaults:{flex:1},
items:[
{xtype: 'spacer'},
{
xtype: 'button',
ui:'action',
height:30,
width:103,
id: 'profileButton',
text: 'Profile'
},
{xtype: 'spacer'},
{
xtype: 'button',
ui:'action',
height:30,
width:103,
id: 'positionsButton',
text: 'Positions'
},
{xtype: 'spacer'},
{
xtype: 'button',
ui:'action',
height:30,
width:103,
id: 'actionButton',
text: 'Action'
},
{xtype: 'spacer'}
]});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.