Skip navigation
Currently Being Moderated

Programmatically Select Items in a List using service results?

Aug 19, 2010 10:05 AM

Hello Adobe Forums, I hope this post finds you well.

Flex n00ber here and I sure could use some help understanding this process.  It's killin' me!

 

I have a ComboBox being populated by a system service array of values. (getSystems())

I also have a multi-select enabled spark List being populated by a different service. (getIterations())

The label values for the spark list are just numbers 1 through 15.

 

What I'm trying to achieve:

 

When I select a system in the cbo box, I need to call a service that returns an array of the values associated with that selected system and then programmatically select those values in the spark list.

 

I do have a service that returns an array of that data based on the value of the cboBox.selectedItem.sysID. (getIterationsBySysID())

 

What does it take to make this happen?

 

I hope I explained this in a meaningful way.

 

ciao,

-aaron

 
Replies
  • Currently Being Moderated
    Aug 19, 2010 10:03 PM   in reply to Aar0nm

    Hi

     

    Just set the selected items property of the list control with the array thet u are getting from the service or

    match the service results with the complete data in list and find the index of each and every item that has been returned from the service and

    push the index values to an array and assign the array to the selected indices property of list .

    This will show all the  index values as selected.

     
    |
    Mark as:
  • Currently Being Moderated
    May 1, 2012 4:48 AM   in reply to Aar0nm

    spark.components.List has spark.components.SkinnableDataContainer in its class hierarchy which dispatches a dataProviderChanged event whenever the dataProvider changes. Unfortunatly there is no [Event] metadata in SkinnableDataContainer that allows using this event in MXML. So, you'll need to create your own custom component that extends List.

     

    package
    {
       
    import spark.components.List;

       
    [Event(name="dataProviderChanged", type="flash.events.Event")]
       
    public class MyList extends List
       
    {
           
    public function MyList()
           
    {
               
    super();
           
    }
       
    }
    }

     

    This works with other List-based components (like DropDownList) too.


     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points