DataRowPanel column parameter?

I’ve been having problems with dynamically building up a data grid. The last hurdle I crossed was getting a pinned DataRowPanel to serve as a header row. It wasn’t rendering properly, but by following along with other examples here in the forums, I found that setting the “column” parameter when adding header labels resolved it.

I’d like to explore further what this “column” parameter is for, but the docs only mention it in passing (Anvil Docs | anvil). Can someone point me to docs or code which explain this?

Thanks in advance!

The column parameter is a way to match the component with the column described in the id field of the columns property of the DataGrid.

You can clone this app and see how I used it: DataGridJson - A DataGrid with quick simple setup

I wanted the headers to be clickable, so I removed the automatic header, added one pinned row, played with css to add the bottom border, played with the column and other properties, kept in mind that the pinned row is included in the count of visible rows on the current page, so I increase the number of rows per page by 1.

The columns passed to the DataGridJson custom component des not contain the required id field. The custom component calls the _add_ids_to_columns function to add an unique id to each column.

Then, when adding the header row in _create_headers, it matches the header with each column with self.header_row.add_component(link, column=column['id']).

2 Likes