PDA

View Full Version : How to get index of an item within a panel?



basememara
21 Jan 2012, 4:38 PM
I have a reference to one of the items in a panel like this:


var myItem = myPanel.getComponent(someid)

How can I get myItem's index position? I would like to add a new object before or after it.

vietits
21 Jan 2012, 4:58 PM
You can use <panelObject>.items.indexOf(object). With your example code, you can determine the index of the component with:

var index = myPanel.items.indexOf(myItem);