Page 1 of 1
Vertical center alignment of data grid row
Posted: Fri Oct 31, 2014 10:31 am
by AppleBite
I'm new to Livecode and can't find a solution for my problem:
I have 2 columns in a datagrid. First column is a normal text column, second is filled with an image and a fixed height.
Now the text of the first column is always at the top of the row. Doesn't look really nice.
How could i align the text of the first column in the vertical center of its row?
Thanks for help

Re: Vertical center alignment of data grid row
Posted: Fri Oct 31, 2014 12:47 pm
by Klaus
Hi AppleBite,
1. welcome to the forum!
2. Is this a datagrid of type FORM or TABLE?
Best
Klaus
Re: Vertical center alignment of data grid row
Posted: Fri Oct 31, 2014 12:56 pm
by AppleBite
Hi Klaus,
the style is "table".
regards from
Applebite
Re: Vertical center alignment of data grid row
Posted: Fri Oct 31, 2014 1:29 pm
by Klaus
Ah, OK, hmmm, that is not easy, I don't have any idea right now...

Re: Vertical center alignment of data grid row
Posted: Fri Oct 31, 2014 1:57 pm
by newtronsols
Isn't that select "table" group, Property inspector, columns, align center for a selected column?
Re: Vertical center alignment of data grid row
Posted: Fri Oct 31, 2014 2:02 pm
by Klaus
newtronsols wrote:Isn't that select "table" group, Property inspector, columns, align center for a selected column?
That's all HORIZONTAL alignment and we don't want that, see thread title!

Re: Vertical center alignment of data grid row
Posted: Sun Nov 07, 2021 10:40 pm
by Monox18
I came across to the same problem today to vertically center the rows. Basically you have to change the dgProps["default column behavior"] to a custom row behavior and change the field's topMargin to make it work. It's rather simple. Try the attached stack which contains a normal DG and a DG with centered rows.
Also posted on
Bug #16542
Re: Vertical center alignment of data grid row
Posted: Sun Nov 07, 2021 11:30 pm
by stam
AppleBite wrote: ↑Fri Oct 31, 2014 10:31 am
Now the text of the first column is always at the top of the row. Doesn't look really nice.
How could i align the text of the first column in the vertical center of its row?
You have edit the margins of the text in that cell, but it's not that straightforward.
You have to edit the template for the column: In the properties panel, in the 'Columns' Tab, select the column you want to edit and click the small button bottom right ('add custom column behaviour') if you haven't already.
This will bring up the column template (you can have templates for each column if you want, but not needed). You can return to this at any time from the 'data grid' tab and clicking the 'row template' button.
Then you need to edit group to get to the individual column
and then edit group again.
Then you can edit the text field corresponding to the column directly. You'll want to change the margins - usually set to 8 or something like that. if a single digit, that means left/top/right/bottom margins are all that digit (eg 8,8,8,8) Just increase the 2nd item (top) and that should push your text down - eg set margins to 8,12,8,8
Hope that makes sense
Stam