PDA

View Full Version : Getting a child component's index number



mx_starter
21 Oct 2013, 5:35 AM
Hello, how can i get the index position for particular component which is part of the items collection of its container?

For example, i have a fieldcontainer with several text fields within. When i take some of these textfields - how to determine the field's insert position?


{xtype: 'fieldcontainer',
items: [
{xtype: 'textfield', id: 1},{xtype: 'textfield', id: 2}...
]
}

When iterating trough the items of the fieldcontainer, how to determine that textfield with id: 1 has an index 0 in the items collection of its container?

Is there something like 'getMyPositionInTheContainer()' :D

ettavolt
21 Oct 2013, 7:26 AM
No, but you can try container.items.indexOf(child).