Using a DataRowPanel without a DataGrid component

Is it possible to use a DataRowPanel without a DataGrid Component and bind a dict or list to the DataRowPanel item?
Below is clone of a demo app.
https://anvil.works/build#clone:ELMP63XAFIAE6AF6=2OCRHX3LFZGMFN7BORGF3LES

It seems that you cannot set the DataRowPanel’s item to a dict when used on its own.

Is your DataRowPanel structure very complex?

I ask because certainly you could build the DataRowPanel in code, and then loop through a list to populate it. That’s kind of like binding it in a way.

For example,

my_list=['johnny', 'jammy']

drp = DataRowPanel()
for item in my_list:
  drp.add_component(TextBox(text=item))
  
self.column_panel_1.add_component(drp)
1 Like

The DataRowPanel is unpredictable outside a DataGrid; its whole point is that it has columns that line up with the enclosing DataGrid.

What are you trying to use it for here? There is probably a better way!

just using it as a container for a few labels. would it work with a flow panel, instead?

Then I would suggest using a FlowPanel or GridPanel instead! They have more predictable behaviour :slight_smile:

FlowPanel or GridPanel dont have an items attribute

I think you would need to populate the panel in standard ways (loops, manually, etc).

You can also use a repeating panel and make it a horizontal repeating panel. There are some forum posts about it.

This would make sense if you want to take advantage of the items property.