1. #1
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    Cave
    Posts
    176
    Vote Rating
    2
    29er is on a distinguished road

      1  

    Default Best way to get index of an element in a Container

    Best way to get index of an element in a Container


    Hi,
    sorry a newbie 'best practices' question.

    Inside my Container i have multiple components.
    When a user clicks on one of these components i want to know the index of that item within the container.
    What is the best way to get this ?

    Thanks

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,337
    Vote Rating
    75
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      1  

    Default


    myContainer.items.indexOf(myChildContianerRef);

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    Cave
    Posts
    176
    Vote Rating
    2
    29er is on a distinguished road

      0  

    Default


    thanks so much !
    hey i just bought your book, reading it now. LOVE it

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,337
    Vote Rating
    75
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    thank you

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    1
    Vote Rating
    0
    wholladay is on a distinguished road

      0  

    Default How do I get the container object?

    How do I get the container object?


    How do I get a container object from a child element? Following is what I'm trying to do, but tr.items returns undefined.


    handleHeaderKeyPress: function(event) {

    if (event.keyCode == event.ENTER) {
    var td = Ext.get(event.target).parent('td');
    if (td) {
    var tr = td.parent('tr');
    if (tr) {
    var index = tr.items.indexOf(td);
    if (index > 0) {
    this.fireEvent('headerclick', this, index, null);
    return false;
    }
    }
    }
    }
    return true;
    },

  6. #6
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,332
    Vote Rating
    83
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi

    I guess td and tr is dom element so you can try instead of tr.items

    Code:
    tr.ChildNodes
    Regards
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Similar Threads

  1. [RESOLVED] ComboBox list z-index lower than container problem
    By wez.morris in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 16 Jun 2010, 11:40 PM
  2. Replies: 6
    Last Post: 12 Jan 2010, 3:46 AM
  3. Ext.Element.scrollIntoPosition - scroll an Element within a container to anchor point
    By makana in forum Ext 3.x: User Extensions and Plugins
    Replies: 0
    Last Post: 11 Dec 2009, 9:23 AM
  4. Get container index for a given component
    By mojotosh in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 19 Oct 2009, 11:43 AM
  5. get the index of a panel inside a container
    By dolittle in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 10 Feb 2008, 2:20 AM

Thread Participants: 3

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