2 Replies Latest reply on May 9, 2008 11:06 PM by Gregory Lafrance

    limit list Items

    Level 1
      Hello All,

      I want to create two lists which will be drag enabled.

      I want one list to have any # of items but I want the second list to allow only 7

      when a user drags an item from the large list to the limited list the item in the limited list that the new item was released on is replaced.

      I'm sure I can use selectedIndex for removing the oldItem but how can I limit the list to only allow 7 items?

      Thanks for any help/leads in advance.
        • 1. Re: limit list Items
          Garyl Woolworth Level 1
          If both lists are using ArrayCollections for the dataProviders you could do a check when the item is dropped onto the smaller list of the length of the ArrayCollection. If it's < 7 ArrayCollection.addItem(object) else ArrayCollection.setItemAt(object, calculatedDropIndex) to replace the item instead of adding a new one.
          • 2. Re: limit list Items
            Gregory Lafrance Level 6
            Perhaps in your drag n drop handler you can simply access the dropped data, and take only the first 7 items in the dropped data. You could even popup an alert telling the user only 7 items are allowed, and the first 7 were copied. Then they can specifically drag 7 they want to copy if they desire.