This content has been marked as final. Show 3 replies
selectedIndex is the property that keeps track of the index of the selected item in any List-based control. Try:
Deepa Thanks for your response. I tried what you suggested but I keep getting out of Range errors.
I have a hierarchical XMLListCollection:
<Captials label="US State Capitals">
<capital label="Al" value="Montgomery0"/>
<capital label="Ak" value="Montgomery1"/>
<capital label="Ar" value="Montgomery2"/>
<capital label="At" value="Montgomery3"/>
<capital label="Ap" value="Montgomery4"/>
<Captials label="something" />
The tree controls display's it properly. When I open the tree item it displays the child nodes. When I select the one of the subtree item and click delete, I get Out of Range error.
One thing I noticed was that the selectedIndex changes depending upon whether the item with children is open or close. if its open the children take the next index. If its closed, the next tree item gets the index.
Not sure how to go about deleting child nodes correctly.
Deleting an item causes the indexs to change. Try saving the selectedIndex in a variable, then using that in the removeItemAt() method.