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

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.

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);