1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    3
    Vote Rating
    1
    gxenus83 is on a distinguished road

      0  

    Default itemtaphold event on nestedlist

    itemtaphold event on nestedlist


    Hi,
    I'm trying to generate an editable nestedlist by adding some buttons on a docked bar and by using the itemtaphold of the list created in the nestedlist to delete and edit them, but I have a little problem.

    I have added an event to the nested list add items for checking the new item and if it is a list then capture the itemtaphold event of the list.

    All works fine so far, except that when the item is a node (not a leaf) it generates the itemtaphold but it also fires the default action of the nested list that is goToNode.

    I have made a clearListeners on each list and the default goToNode is not generated but then the vertical scroll of the list stop working.

    Any idea of how to disable only the default itemtap of the nested list or how to restore the Scroller after the clearListeners ?

    Thanks.

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,134
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    You can try calling e.stopEvent() when the itemtap event or default action is fired. (e is passed as a parameter in each event)

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    3
    Vote Rating
    1
    gxenus83 is on a distinguished road

      0  

    Default


    jerome76
    You can try calling e.stopEvent() when the itemtap event or default action is fired. (e is passed as a parameter in each event)
    I have already tried to call stopEvent and return false on my itemtap action but it does not prevent the default action of going to the tapped node.

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    3
    Vote Rating
    1
    gxenus83 is on a distinguished road

      1  

    Default SOLVED

    SOLVED


    I was doing it wrong.

    I was trying to capture the itemtap event from the list added has item to the nestedlist but the itemtap action that was doing the goToNode or goToLeaf is from the nestedlist itself not the list children, so I have done my own nestedlist and overided the onItemTap method to accept the itemtaphold event correctly.

    this is my code for anyone who needs it:

    Code:
    Ext.define("cishome.view.MyNestedList",{    extend:"Ext.NestedList",
        xtype: "mynestedlist",
        config:{
        editing: false,
        isTapHold: false,
        },
        initialize: function()
        {
        this.callParent(arguments);
        this.on("add", this.onAdd, this,{order:"after"});
        this.getActiveItem().on("itemtaphold",this.onHold,this);
        },
        onAdd: function(nestedlist, item)
        {
        if(item.config.xtype == "list")
        {
            item.on("itemtaphold",this.onHold, this);
        }
        },
        onHold: function(list, index, target, record, ev)
        {
        if(this.getEditing())
        {
            this.setIsTapHold(true);
            this.fireEvent("itemtaphold",this, list, index, target, record,ev);
        }
        },
        onItemTap: function(list, index, target, record, e) {
        if(!this.getIsTapHold())
        {
            var me = this,
                    store = list.getStore(),
                    node = store.getAt(index);
    
    
                me.fireEvent('itemtap', this, list, index, target, record, e);
                if (node.isLeaf()) {
                    me.fireEvent('leafitemtap', this, list, index, target, record, e);
                    me.goToLeaf(node);
                }
                else {
                    this.goToNode(node);
                }
        }else{
            this.setIsTapHold(false);
        }
        },
    });
    It also prevent the itemtaphold event if not in edit mode. Just an extra.

  5. #5
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,134
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    Awesome

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar