1 Reply Latest reply on Jul 24, 2008 6:03 AM by anirudhs

    Preselect items in a list

    wkolcz
      Like the datefield post below I have an update form that is meant to update an existing list of people chosen for the project. In HTML I would use a condition saying if the person = the database listing then selected="selected", but I cannot find out how to do this in Flex / AS.

      Basically I have a list that allows mutliple selections and I want them already highlighted if they were chosen initially. Anywhere to find out how to do this?
        • 1. Re: Preselect items in a list
          anirudhs Level 2
          Hi,

          Just build an Array containing the indexes you want to select and set list.selectedIndices to that (where list is the id of your List control):

          var obj:Array = [0, 5];
          list.selectedIndices = obj;

          This will select the 0th and 6th items of your List (if allowMultipleSelection is true)