MattMcCode
MattMcCode

Reputation: 307

Dynamically Create Checkbox Lists Google App Maker

I am fairly new to Google App Maker and I am not sure if this is even possible. I am trying to call an external service based on an ID entered into an input, then display the results dynamically as a list of checkboxes.

I have successfully been able to enter an ID, call my database through JDBC in a server script, and display the returned value from that ID onto the page. But what I really want to do is enter the ID, which calls my database and returns an array of objects (which I won't know the length of until returned), then for each item in my array, dynamically create a new checkbox row with each objects data.

I have been looking around for a solution to this, but can't find any example of widgets being dynamically created. I didn't see anything in the Google App Maker documentation about creating a widget from a script, and wasn't sure if this was possible yet. I was hoping this would be possible with the Accordian widget, as I liked that the rows can be expanded and collapsed, but not sure if I can add radio buttons to an Accordian or not. Even a group of Radio buttons would work as well. Any ideas would be a big help!

Upvotes: 1

Views: 863

Answers (1)

Pavel Shkleinik
Pavel Shkleinik

Reputation: 6347

You need to use Calculated Model. Once you have it you can bind its datasource to a List, Grid or Accordion widget where you can add any other widget (even checkbox!) to its prototype row/cell. External Database Sample could be a good starting point since you are reading data from external database.

From the question it is not clear what do you want to do with the checkbox further, but I think reading about page Custom Properties, Checkbox Events and Apps Script RPC could be useful.

Upvotes: 2

Related Questions