Select button or checkbox on table?

What I’m trying to do:

I’m trying to show some data on a table. There’s filters at the top that the users can use to filter the table. Once they find a row with the item they want, they need to be able to select it.

This can be a checkbox or a button or even a click if that’s what I can od.

What I’ve tried and what’s not working:

As a test, I tried inserting on the repeating panel show buttons and checkboxes but it’s not working.

Code Sample:

    def results_rows_datagrid_repeating_panel_show(self, **event_args):
      """This method is called when the RepeatingPanel is shown on the screen"""
      self.results_rows_datagrid_repeating_panel.items = [
        {'select': Button(text='select'), 'name': "abc", 'revenue': "123"},
        {'select': Button(text='select2'), 'name': "def", 'revenue': "456"},
        {'select': CheckBox(text="sometext"), 'name': "ghi", 'revenue': "456"}
      ]

Has anyone built something similar where a user can select an option? Not sure how to approach this.

Without seeing the rest of the code (e.g. a clone link) it’s hard to say why that isn’t working. In general, setting a repeating panel’s .items attribute just makes those items available to the repeating panel’s row template.

But what is that row template doing with those items?

What I normally do is I put all the components I want directly into the row template through the IDE. Then I pass into the .items attribute enough information to say which components should be visible (e.g. data binding to the visible property of those components).

Right now it’s like they’re using print() on them

<anvil.Button object>
<anvil.Button object>
<anvil.CheckBox object>

On Design mode, on the right hand side what I see the columns and I can put the title and key on them.

Could you expand a little on how you add them to the row templates on the IDE? Sounds like it’s possible, but I’m just missing something.

@jshaffstall I think this link should work,

Clone Test app

Have you been through the Data Grid tutorials? Some of those show how to manipulate the row templates: Anvil | Displaying Data In Tables

If you double click on the rows in the IDE, it should open up the template, where you can drag and drop components onto specific columns to override the default behavior of just printing out what’s in that column.

Edit: Here’s a clone link that shows my general approach: Anvil | Login

That won’t help you get there yourself, though, so definitely go through the data grid tutorials. They should show you how to edit row templates.

Here’s the code for setting the repeating panel items:

    self.repeating_panel_1.items = [
      {'use_button': True, 'use_checkbox': False, 'text': 'select', 'fname': "abc", 'lname': "abc"},
      {'use_button': True, 'use_checkbox': False, 'text': 'select2', 'fname': "def", 'lname': "def"},
      {'use_button': False, 'use_checkbox': True, 'text': "sometext", 'fname': "ghi", 'lname': "ghi"}
    ]

I use those values to determine which component should be visible in each row.

I had not seen that link! Thank you for the tutorial link and example!