AssistoLab / DropDown

A Material Design drop down for iOS
MIT License
2.44k stars 622 forks source link

How to make datasource dynamic? #89

Open SachinSabat opened 7 years ago

SachinSabat commented 7 years ago

Please provide some example for it.

SachinSabat commented 7 years ago

I am unable to pass any data structure to datasource eg, selectPayment.datasource = elements[i].customer_name

Abhishekl90 commented 7 years ago

I facing same issue, I am getting array from server and trying to bind it to data source as:
dropDown.dataSource = myArray But the dropDown isn't showing me any data. But when is bind the static array ,it is showing me the data.

grabarz121 commented 6 years ago

Just call some function, which will get new data to the DropDown, and assign new array like DropDown.dataSource = [your_array_variable] (or assign an old array, but second time)

kevin-hirsch commented 6 years ago

Hello everyone,

DropDown.dataSource is not made to support changes like myDropDown.dataSource[1] = "newValue"

You have to assign a new array of Strings each time myDropDown.dataSource = myArrayWithNewValues. This should work.