Grid - right justify keeps text left

1 Answer 31 Views
Grid Styling
Mike
Top achievements
Rank 1
Iron
Mike asked on 16 Dec 2024, 08:58 PM | edited on 16 Dec 2024, 10:25 PM

We have been using the grid control for quite some time and we just now noticed the logic we use to right-justify the header text appears to not be styling as intended.  I have attached a screen shot to show the odd display.  The text is right-justified but the header text is still on the left of the column.  I should note it is common practice, especially for reports, to right justify both the text and the header when showing numeric values so the decimals align.

<column field="CurrentOverCount" title="Over<br />Employee Count" width="70"
        header-html-attributes='new Dictionary<string,object> { ["class"]="text-end" }' html-attributes='new Dictionary<string,object> { ["class"]="text-end" }' />

I have also tried using pure CSS for the header with the same result:

<column field="CurrentOverCount" title="Over<br />Employee Count" width="70"
        header-html-attributes='new Dictionary<string,object> { ["style"]="text-align:right;" }' html-attributes='new Dictionary<string,object> { ["class"]="text-end" }' />

1 Answer, 1 is accepted

Sort by
1
Accepted
Alexander
Telerik team
answered on 18 Dec 2024, 12:10 PM

Hi Mike,

With our recent release, we have introduced vigorous changes to the way the Grid is rendered. I can suggest adding the "justify-content: right" property to the header attributes:

<columns>
     <column 
		  field="ShipName" 
		  title="Over<br />Employee Count"
          header-html-attributes='new Dictionary<string,object> { ["style"]="justify-content:right;" }' html-attributes='new Dictionary<string,object> { ["class"]="text-end" }' />
</columns>

An identical configuration is also demonstrated in the following demo:

This should then produce the following result:

Here is a Telerik REPL example for you to examine further:

I hope this helps.

Kind Regards,
Alexander
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Mike
Top achievements
Rank 1
Iron
commented on 18 Dec 2024, 08:35 PM

Thank you.
Tags
Grid Styling
Asked by
Mike
Top achievements
Rank 1
Iron
Answers by
Alexander
Telerik team
Share this question
or