I’m new to Anvil, and this is the first problem I’ve encountered that doesn’t seem to have a solution somewhere fairly easy to find.
I added a Data Grid, but I wanted the column headers to be buttons (clicking on a button sorts by that column.)
I added a Data Row Panel and eliminated the header row, and the grids do align. But when I add Buttons to each cell of the Data Row Panel, they don’t align with the data in the Repeating Panel. Since they don’t, there’s no way to align the Text in the Button with the Text in the Repeating Panel. If I populate the Data Row Panel with Labels, I can make the alignment work fine, but then you can’t click on the Labels to Fire the sorting event for that column.
Hello and welcome,
Could you share a basic clone to demonstrate? It sounds roughly like you are doing this correctly. Click the
icon and follow the instructions.
Okay, you should use a DataRowPanel in the repeating elements as they are “column aware”.
For example:
Clone:
https://anvil.works/build#clone:DLL452HNBVO3YP2S=74MNZJW2X2ITZP7TFA4X6NQN
Thanks! You’ve obviously solved my problem. The only thing is, I can’t figure out how you changed it!
There is a datarowpanel in the repeating panel rows. You can find the apps structure represented as a tree on the right in the IDE but if you click on the repeating panel template and look closely you should see the datarowpanel.
Apologies for my cluelessness. I see the datarowpanel in the template form, but I can’t figure out how to get it there. If I drag a datarowpanel into the template form, it goes into one of the three cells, not across the bottom like your example does.
You have to drag it around a bit (possibly near the bottom of the row) until you see the blue indicator line go long.
1 Like
That did it! It took me quite a while, though. Who knew that computer programming required so much patience and dexterity… Thanks.
Haha yes, there are aspects of Anvil that require some fine motor control
. Luckily Anvil makes nearly everything else lighting fast so it’s worth it!
1 Like