4/4/2011 3:59:13 PM
Title:
setSelectedIndices on list troubles
I am trying to debug a Flex 4 application by other developer(s). I need to set the selected indices for a list. I have a sub-class to do the work. I have tried all forms of commands to set selected indices but nothing actually writes, even setting selected indices to null. Here is some code:
import mx.core.mx_internal;
use namespace mx_internal;
trace ("last indices: " + _lastSelectedIndices_vector);
//trace shows the values in the vector (created and populated elsewhere)
trace ("current selected indices: " + selectedIndices);
//trace shows data provider currently selected indices values
mx_internal::setSelectedIndices (_lastSelectedIndices_vector, false);
trace ("new selected indices: " + selectedIndices);
//trace shows same values as current selected Indices (no change)
I have also tried:
selectedIndices = _lastSelectedIndices
and many other tweaked attempts. All to no avail. Documentation and many examples from the web show that this should work.
Please help me set selected indices!
4/5/2011 12:49:04 AM
try passing a hard coded array to see if you are setting indices at the right place.
4/5/2011 1:18:49 AM
it seems that the indices are being set before its being actually populated.
4/5/2011 9:52:23 AM
Thanks for your thoughts. I tried assigning null and a fixed array but neither change the selected indices (for which values do already exist and can be read via trace just before and just after = same). Assigning the data provider happens elsewhere and is already done when this code runs.