Open mkinnan opened 7 years ago
@mkinnan This one would be tricky to add to core, so I've typically utilized a pageshow
callback on my page (the page usually contains a form, is is a direct form load via drupalgap_get_form()
) and the page_callback
(or form builder) just returns an empty select list element (or just the typically the empty '': '-- ' + t('Please select') + ' --')
option. Then in the pageshow
handler, make a custom service resource call (or views datasource json call, or a hook_menu()
style call that we use with DG autocompletes) to fetch the JSON data which will contain a list/array of entity id and labels that I'd like to use for my select list options. Once retrieved, I'll iterate over them and dynamically inject them into the waiting select list using standard jQueryjQueryMobile API's.
@signalpoint Thanks for the feedback!! Here's what I finally got working:
https://github.com/signalpoint/DrupalGap/pull/934
I welcome suggestions/edits in hopes to have it an example Doc.
Is there any reason I should be using a form instead of a page in which the widget onchange saves the selection immediately? I've found I prefer the onchange->save route instead of using forms.
Here's a picture of my remote custom data for my Select List:
I accomplished a similar application by using the location module and custom services and forms. The location module would gather an array of Provinces for a given country, and then inject them using JQUERY into a waiting Province Select list.
It was a completely original implementation, and again, I only used Custom Services and Custom Forms to accomplish this, utilizing JQUERY to inject the results into a waiting select list.
It seems that you have gone about the process in a completely different way utilizing Autocomplete and 'pages'. A very interesting post, as it took me some time to conceptualize this process.
@gs9999 Thanks for the feedback! Your approach sounds like another great approach!
I was intentionally trying to not use a form. I wanted users to be able to tap/change a value and have it instantly update rather than having users click a Save button. I have a Your Location user settings page for toggling location based information. I use address module stead of location. Then I geocode the user address.
I hacked together some of the different tutorial pages: http://docs.drupalgap.org/7/
How difficult would it be to implement remote custom data for select lists?
What functions would need to be modified?