Adding Row to Table with Dropdown

What I’m trying to do: My app consists of a text area, a dropdown and a button. I have a data table having two columns. One of them shows content from dropdown. What I’m trying to do is that I want the user to type in the text area. Then, the text will be added in the same row where the selected value from dropdown is located. I know there’s an example similar to my query but I don’t want to link tables.

If this is confusing, I’ll share the clone

What I’ve tried and what’s not working: Instead of displaying the selected value as text, it rather shows some LiveObject etc.

Code Sample:

# code snippet

Clone link:
share a copy of your app

Hi @divyeshlakhotia,

It will be much easier to help if you can provide some code snippets or a clone link to a minimal app demonstrating your issue. :slight_smile:

1 Like

Link to My Example App

This is the example app. Feel free to edit it and share it back to me if you want. Thank you so much for your time :smile:

Presumably you want to be able to add multiple names in the name column to a single row. If you don’t want to link tables, one way you could do this is by creating a Simple Object column in your Entries Data Table (instead of a text column). You could then append the text from the Text Box to a list in that column. In your example app, you could do:

  def button_1_click(self, **event_args):
    """This method is called when the button is clicked"""
    entries_row = self.age.selected_value
    if entries_row['Name']:
      entries_row['Name'] += [self.Name.text]
    else:
      entries_row['Name'] = [self.Name.text]

Thanks a lot for your help! This might be of great help.

I’m trying to build a community for the readers to share their stories. The various features I wish to add like ‘Trending’, ‘Reccomended’ are proving to be a challenge but Anvil community is helping me at each and every step.

Thanks a lot again

1 Like