tarun_sharma
tarun_sharma

Reputation: 871

Sencha pop over on list itemtap

In my application i have a list. I want to show a pop over (overlay) when an item is tapped. It works for some items but for some items the overlay goes right to the list item.

Note: I want to show an overlay with arrow pointing to current selected item. Here is my code:

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();           
    }
}});

Problem may be i am not getting the list item correctly. I just used the current element here. I also tried list.getNode(index) but it does the same thing. Can anyone guide me in right direction?

Tarun.

Upvotes: 0

Views: 3488

Answers (2)

tarun_sharma
tarun_sharma

Reputation: 871

Here is my panel code.

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'}
]});

Upvotes: 0

ilija139
ilija139

Reputation: 2974

just add false to the show by function i.e. overlay.showBy(element, 'fade',false);

http://docs.sencha.com/touch/1-1/#!/api/Ext.Panel-method-showBy

Upvotes: 2

Related Questions