Page 1 of 1

column justification

Posted: Thu Jun 08, 2017 11:35 am
by dkmccammon
Is there an easy way to justify the grids in a column on a column by column basis rather than applying the justification to the whole grid?

For example say I need the first and second column to be left justified, but the 3rd and 4th column I need to be centered, and the 5th and 6th column I need to be right justified. Is this possible to do with the Genie tool?

Re: column justification

Posted: Thu Jun 08, 2017 11:59 am
by Scott Klement
Are you referring to the "text align" property? We don't have one called "justification", but this would be the closest thing, I think.

If so, you can choose "other" for the property, and this will let you type into the property box (instead of using the drop down). You can then set the property to a separate value for each column... so if you had three columns, you wanted the first one to be left aligned, the second to be centered, and the third to be right aligned, you could click Other and set it to left,center,right

Assuming that you are referring to data on a 5250 screen, however... there is one caveat: 5250 data is generally padded with blanks. So if you have a 5 character field where you see "X", it actually will contain "X-blank-blank-blank-blank" That can really screw up text alignment, because the blanks are included in that alignment -- but. that's the way 5250 works, unfortunately.

If this weren't a grid, you could fix it by changing the "value" property of the widget. The default is "script: value" and you could change it to "script: trim(value)" to remove the blanks. But, that's not so easy in a 5250 grid because the data is automatically "consumed" from the screen and put into the grid, so you don't have a value property like you would with a simple output field.

Never really thought about how you'd override the text-align in that case. I guess you could write JavaScript code that would loop through the grid and remove the blanks... kinda awkward, but it'd work.

Re: column justification

Posted: Thu Jun 08, 2017 2:03 pm
by dkmccammon
For whatever reason, this is not working for me. And yes, I meant the alignment option. I am not sure what is keeping it from working, I have checked my CSS and cannot find anything that would over-ride the alignment assigned in the Genie design screen. But the columns are not responding.

Re: column justification

Posted: Thu Jun 08, 2017 2:10 pm
by Scott Klement
Maybe the extra blanks? (see my explanation, above.)

Re: column justification

Posted: Thu Jun 08, 2017 2:14 pm
by dkmccammon
I read the explanation in your previous post. But I would expect that at least some of the columns in some of the grids would move at least a little. But it makes no difference to the grid at all if I choose to left justify, right justify, center, or choose other and create a column by column justification separated with commas.

Re: column justification

Posted: Thu Jun 08, 2017 2:27 pm
by Scott Klement
I'm pretty sure it's because the columns are completely full (filled with blanks) since there's no extra space left to move to the left/right it would not look any different.

I haven't tried it, though. Perhaps I should run a quick test and see...

Re: column justification

Posted: Thu Jun 08, 2017 4:28 pm
by Scott Klement
I ran a test, and this turned out to be really difficult to remove the blanks. Once I finally got that working, I can confirm what you said -- the "text align" property doesn't work because of the way Genie consumes the data from the screen.

So unfortunately, this feature will not work from 5250 data. It will work (in Genie or Rich Display) when loaded from a database-driven grid, just not from 5250 data.

You could use JavaScript or CSS to change the text alignment instead of the property. Awkward, but it'd work...