Display a list of lists in a grid

A custom component I’m calling “Matrix” to display an arbitrary list of lists in a grid (using DataGrid under the hood), so that…

 self.add_component(Matrix(items=[[1, 2, 3], [4, 5, 6]]))

…displays this:

https://anvil.works/build#clone:UTQM7BV7NKJZLP4K=KDRUYDUDUBPBC76AWLCB4BCJ

I’m not sure how useful this is, but just in case. It was inspired by this forum post:

Next step might be to allow an ‘item_template’ property as a template for each cell…

5 Likes