Multiple Row Selection with Checkboxes

What I’m trying to do:
I have a table A with a column, say “House Types” that links to multiple rows in another Table B.

Table A is a user-unique table, and Table B is a more generic lookup (front-end searchable) with one column and just a number of, say, 10 house types.

And I have a front end form that I would like to allow user to select House Types. The selection should be a number of checkboxes with all the values of Table B. So, say they selected types 1,2 and 5, and then they clicked submit, the column in Table A should update with the multiple rows 1,2 and 5 linked to the Table B.

The next time the user opens the form, they should be able to see 1,2,5 checked

What do I need to do on the front end to achieve this?

I have tried looking at using DataGrids, but not really sure how this is put together. Not even sure if this is the way to do it - but do let me know and step-by-step instructions are much appreciated. Thanks!

Welcome to the Forum!

Data Grids are definitely the way to go, here. They save a lot of work. Suggest you start with the appropriate Tutorial (see links at top of this page). (Also Docs.) That will set the stage for a Forum search, if you still have questions.

Thanks for the suggestion.

Though I find it odd that just working on a tutorial requires one to begin a trial. Getting Started (anvil.works).

This DataGrid Tutorial is unlike the other tutorials.

The Tutorials wisely give you experience with using the Anvil IDE.

Use of the IDE does require signing up. After all, Anvil needs a way to distinguish your work from some anonymous Jane/Joe’s. You don’t want them stepping on your work, or vice versa.

But it’s not a trial. The bottom tier is free. Period. No time limits. Many folks you’ll see on this Forum stay on the Free tier, indefinitely. It’s perfectly viable for many. I eventually found a good (business) reason to level up, but that was only after several months of use.

I’m pretty sure that none of the Tutorials requires any higher tier; or in the rare case that they do, then they’re well-marked.

No worries - did manage to get through tuts and made a few implementations with Datagrids in the past few days. Really easy to pick up!

I now have this issue, diving deeper into the datagrid and the Row structure.

Say we have on the database table, a column a with a list of several rows selected from another table such that a = [Row1, Row2, Row5] in the livetables object format.

We then have another complete list coming from the lookup table for those Rows: b = [Row1, ..., Row10]

Next, we have self.panel.items in the repeating panel of the datagrid set to the items in b

We have a checkbox on each datarow. This checkbox should read such that it’s True if the item exists in a else, False.

A simple proxy example in lists would look like this:

a = ['a','  b','c','d']
b = ['c']
c = [x in b for x in a]

print(c)
[False, False, True, False]

c would be used in the self.items['checkbox'] equivalent. I’m just confused how to execute this based on the livetables row object.

Any help on how to do this and extend the items returned from app_tables so that it can be used with datagrids/repeating panels?