Welcome, Guest
  • Author Topic: setDataProvider  (Read 1040 times)

    jiffyloop

    • Server what's that
    • *
    • Posts: 22
    • Flash-db Rules
      • View Profile
      • Email
    setDataProvider
    « on: 04/11/03, 14:24 »
    I've been having this problem trying to set the "setDataProvider" for a combobox. The syntax for this is:

    componentName.setDataProvider(dataprovider)

    I notice that the name of the dataprovider doesn't require quotes.

    foodArray = ["fruit", "vegetable"]
    fruitArray = ["apple", "orange", "banana"]
    vegetableArray = ["carrot", "celery", "cucumber"]

    This would work for me:

    food_cb.setDataProvider(fruitArray) or food_cb.setDataProvider(vegetableArray)
    but I want to be able to dynamically create the data provider name.

    Say I have two buttons, fruit and vegetable that both select a name from the foodArray
    Can I use this value and combine it with a string to populate my combo box?

    selectionType = foodArray[0]

    food_cb.setDataProvider(selectionType + "Array")
    or at least something of that nature

    Any help would be appreciated.

    Thanks,

    Jiffy Loop


    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:setDataProvider
    « Reply #1 on: 04/12/03, 03:49 »
    Add an array of arrays and uses index to acces your value. In example, here I use the second array to populate my ComboBox named myList:

    [script]
    foodArray = ["fruit", "vegetable"]
    fruitArray = ["apple", "orange", "banana"]
    vegetableArray = ["carrot", "celery", "cucumber"]
    currentArrays = [foodArray, fruitArray, vegetableArray]
    myList.setDataProvider(currentArrays[1])
    [/script]

    Jorge