Issues with dynamic select dropdown not populating
Issues with dynamic select dropdown not populating
randy.johnson
Posts: 18Questions: 8Answers: 0
in Editor
Url: http://propane.randy1.com/randy
I setup an editor datable with inline editing.
I am trying to get the select dropdown to populate from the local database.
I have tried passing a function to the options:
options: getWarehouseCategories()
as well as via the update statement.
editor.field('intWarehouseCategoryId').update(getWarehouseCategories());
neither of these options are working.
Thank You for your help.
Randy
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
Thanks for the link. When I load it it makes a request to get data for the table from
"/warehousetypes/ajax_warehouse_subcategories"
- however, that is note returning JSON - it looks like it is in fact returning an HTML document. Do I need a log in or something for it to work?Allan
oops, that was me not updating the link for the tester page.
http://propane.randy1.com/randy
Updated now to point to the right spot.
That won't work because
getWarehouseCategories
returns undefined. The closure function being used in thedone
callback returns the JSON, but that isn't going anywhere. You would need the Ajax call to be synchronous if you wanted that to work (and even then the return would need to be in the host function), but that's really bad for usability as it locks up the browser.Instead, what you could do is:
and in the in main function:
Another option is you have
/randy/ajax_warehouse_subcategories
return the options information in its data structure and Editor will automatically detect that. This is detailed in this section of the documentation and there is an example here.Nice background on the page btw!
Allan
Worked like a charm. Thank You Allan