Text align and line wrap in grid column

Hello,

I am dealing two problems in this design:
[LIST=1]

  • The content of column "Descripci?n" is not aligned in the left even it was set at the field's properties.
  • The content of column "Descripci?n" is taking the whole screen's width.. and more! to display the text, see how the horizontal scroll bar appears at the bottom. [/LIST] For problem 1: I do not know what more to do, the text simply keeps its center alignment For problem 2: I do not know how to wrap the text, so if the text reaches the width of the table then breaks it into a new line.

    Thank you in advance.

  • +1
    I too have these problems with alignments in some grids.

    For issue #2 you should be able to set the field to wrap text: Fields -> [FieldName] -> Display settings -> Line Break.
    Did you do that?

    Hello @robydago,
    Yes, I did it testing both options… no success.

    Hi I have also been facing the same issue and here is the trick I use to over come the above issue. Place the following in the onLoad event of the Grid

    echo "
    <style>
    .css_to_name_label {vertical-align: top;text-align: left;}
    .css_to_name_grid_line {vertical-align: top;text-align: left;}
    </style>
    ";

    The first line is the Title for the field name to_name and second line is for the content of the field. SC creates different classes based on the field name so you can do by field level

    If you want to apply the same formatting to all the title and fields (if you are using 8.x version then) you can use the below

    echo "
    <style>
    .scGridLabelFont {vertical-align: top;text-align: left;}
    .scGridFieldOddFont {vertical-align: top;text-align: left;}
    .scGridFieldEvenFont {vertical-align: top;text-align: left;}
    </style>
    ";

    The first line is for the Title and second is for Odd lines and third one is for even lines

    Hope this helps :slight_smile:

    Regards
    Murali

    Hi,

    If you changed the field to be left aligned in its properties and its still not left aligned.
    Clear your browsers cookies. Sometimes style changes made in the settings don’t take effect immediately. This has worked for me 100% of the time.

    Regards
    Jaques

    The moment you realize you have been struggling with something for months, and the solution was so simple…:frowning:

    I have spent hours modifying code because the grids aligned as they pleased, instead of as defined in the scriptcase configuration… and I never understood why suddenly things worked as they should some time later.

    Thank you Jaques.

    🚀 Scriptcase 9.12 is now available! Check out the new features here 👉🚀 Next Monday (02/24), Scriptcase 9.12 will be released! Check out the new features before anyone else 👉