Using datagrid to display user input components

What I’m thinking to do:
This maybe a wild question considering the true purpose of datagrid…to contain data. I am wondering, however, if it can be used to display components for user inputs. Right now, my user input objects are arranged on the app form window, not haphazardly, but I thought it would be nice to organize it into a table form, like a dataframe.

What I’ve tried and what’s not working:
I tried to drop a textbox and dropdown objects on data row cells, esentially filling a container with another container. When I run the test app, I only see the column headers but no row data.

If this is at all possible, what are the appropriate steps to do? If not, please ignore my curiosity.

Thank you,.

I would suggest going through the datagrid tutorial. From my memory, it shows how to do that and more.

1 Like

I have pored over it, still not sure if it could apply to what I am thinking to do with my user input components, but II will try again.

Thank you.

When it’s just layout help that I need, i.e., to lay things out in columns, I usually use a ColumnPanel. DataGrid is specialized for more complex circumstances, so I use it only when I need those added complexities.

Did you assign content into the textbox and dropdown objects? Either through code or data binding? Because once you put a component into the row template, Anvil stops doing anything automatically for that column.

Thank you for the suggestion. DataGid would have been nicer though, if only.

Romy

Yes, I put data into the components in the row template and tried to do data binding but I could not find this in the Properties panel. Any idea where it might be?

Romy

It’s the little chain link icon next to a property. It’s hard to see in the new designer until you know what it is.

Thank you. Let me try it then so that I have 2 possible options - use column panel or still try DataGrid if I can get it to work.

romy

I did the data binding but the rows still do not show up. Only the table heading shows when I run this test app.

May I share the link so you could see the data binding that I did in the Properties section?

Would appreciate to know what is missing.
Thank you.

You have the item_template in the repeating panel set wrong, so just click this button.

Also, you have to actually set some items to the repeating panel for those bindings to take effect. See the line I added in this clone link:

1 Like

That’s great! Thank you very much.

I had the binding set to that item_template earlier but I switched thinking that the binding must belong to the other one. Still, it would not have worked without the line that you added. I learned a lot from your correction.

More power to you.

Romy

1 Like

Hello, everyone.

After all is said and done, I finally opted to display my input components using ColumnPanel (thanks @p.colbert) instead of DataGrid. I could get better aesthetics and easier to do with ColumPanel.

This is not a No vote on DataGrid, it’s just that I found ColumnPanel easier to apply now on my scattered components.

Thank you all for the tip and help,

2 Likes