Hello, I have a problem that i’ve been fighting for a while.
I have a dropdown menu module that I can add items to for a dropdown widget. I want to automatically generate data from a network request and show it on the dropdown list. I have all the data but I cant get the data to show on the dropdown menu. Heres what i have…
local data local function carListener( event ) local res = json.decode(event.response) if event.isError then print('Error') else native.setActivityIndicator( true ) timer.performWithDelay( 1000, function() data = res['makes'] print(data) native.setActivityIndicator( false ) end ) end end --Get all car Makes local url = 'http://api.edmunds.com/api/vehicle/v2/makes?fmt=json&api\_key={key}' dropOptions = { { title = Makes,--This is where the name of the car makes should be generated action = function() print('clicked') end }, } for i = 1, #data do dropOptions[1].title = data[i].name end myDrop = drop.new{ x = X, y =Y, toggleButton = button, width = 200, marginTop = 12, padding = 20, options = dropOptions } network.request(url,'GET',carListener)
please help
PS. Im using Composer so if you can assist me on where to put the functions that would be great!
Thanks