Results 1 to 3 of 3

Thread: Get record by element in List ("taphold" listener in list)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    Holland
    Posts
    98
    Answers
    2
    Vote Rating
    2
      0  

    Default Answered: Get record by element in List ("taphold" listener in list)

    I want to create a taphold listener to a List. It's impossible to do this directly on a listitem, but it's possible on the underlying element like this:
    Code:
    this.myList = new Ext.List({
        store: store,
        grouped: true,
        indexBar: true,
        onItemDisclosure: true,
        emptyText: 'its empty',
        itemTpl: template,
        listeners: {
            taphold: { 
                element : 'el',
                fn: function(event, e) {    
                    console.log('taphold');
                    // action
                }
             },
        }
    });
    To proces the taphold, I need the selected record. I've no idea how to get the correct record. Has anyone an idea? Thanks.

  2. Tried using the getRecord method on the list?

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    Tried using the getRecord method on the list?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Location
    Holland
    Posts
    98
    Answers
    2
    Vote Rating
    2
      0  

    Default

    Yes, thank you that's right. I need to go two levels up, then it's able to get the right record based on the element. Great!

    Code:
    this.myList = new Ext.List({
        store: store,
        grouped: true,
        indexBar: true,
        onItemDisclosure: true,
        emptyText: 'its empty',
        itemTpl: template,
        listeners: {
            taphold: { 
                element : 'el',
                fn: function(event, e) {    
                    console.log('taphold');
            var element = e.parentElement.parentElement;
            record = bbs.views.companyListView.companyList.getRecord(element);
    
                }
             },
        }
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •