Try this…  What you need to do is add the index to be selected to the selectedIndices array.  Here is an example, I didn’t try this, but it should work.  Let me know if you have problems.

 

var licenseArray : Array = result.licenseStates.split(",");

for (var i : int = 0;i<statesDP.length;i++) {

            for (var j : int = 0;j<licenseArray.length;j++) {

                        if (statesDP[i] == licenseArray[j].label)

                                    parentApplication.mainDisplay.rtvr.licenseStates.selectedIndices.push(i);

            }

}


From: [email protected] [mailto:[email protected]] On Behalf Of Jeremy Rottman
Sent: Tuesday, September 19, 2006 3:57 PM
To: [email protected]
Subject: [flexcoders] Dyamically selecting Items in a list

 

I am trying to dynamically select the items in a multi select list
component. The list that should be selected comes back to me from my
database as a comma delimited list, which I convert to an array. I am
then trying to compare the array that I made from my list, against a
static array of objects which as used as the dataprovider to my list
component. I have tried everything I can think of to automatically
select the items in the static list, but everything has failed.

Can someone give me a hand with this. HEre is the code that I am
currently working with. statesDP is the static data provider for my
list component.

var licenseArray = result.licenseStates.split(",");
for(var i = 0; i < licenseArray.length; i++){
for(var j = 0; j < statesDP.length; j++){
if(licenseArray[i] == statesDP[j].label){
Alert.show(licenseArray[i]);

parentApplication.mainDisplay.rtvr.licenseStates.selectedItems.index = j;
}
}
}

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to