Alignment of kendo grid column data

1 Answer 6866 Views
Grid
obaid
Top achievements
Rank 1
obaid asked on 26 Aug 2021, 02:58 PM | edited on 26 Aug 2021, 03:01 PM

Hello,

I have integrated kendo grid with inline edit with columns config approach. I am dynamically rendering columns in initGrid function.

So here I want you to show me a way to center and right align my grid's column data. Some should be right and some left.

How can I achieve this without css by any kendo class property.

I am using this column config approach for inline edit.

https://www.telerik.com/kendo-angular-ui/components/grid/how-to/persist-state/

Thank you.

1 Answer, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 31 Aug 2021, 11:08 AM

Hi Obaid,

You can use the class input property of the ColumnComponent to assign the class you want.

The CSS classes for aligning text that come with our Kendo Themes are k-text-left, k-text-center and k-text-right.

Please have a look at this Stackblitz example that I prepared for you. It shows how you can apply a different class to each column.

Let us know in case additional information is needed.

Regards,
Ivo
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.

Adam
Top achievements
Rank 1
commented on 26 May 2022, 02:43 PM

Your stackblitz doesn't seem to work anymore—all the columns are left aligned. Are those classes still supported?
Ivo
Telerik team
commented on 31 May 2022, 09:01 AM

Hi Adam,

Yes, the utility classes are still supported.

However, because of some changes in the Grid styles, a stronger (more specific) styles need to be used. For example, instead of the k-text-right class, the stronger !k-text-right should be used (it adds !important). I created a new Stackblitz example with the new classes.

Let us know in case additional information is needed.

Adam
Top achievements
Rank 1
commented on 12 Sep 2022, 08:22 PM

Ivo are there any utility classes that will right align the header to match? I tried headerClass="!k-text-right" but it didn't have any effect
Ivo
Telerik team
commented on 15 Sep 2022, 09:01 AM

Hi Adam,

There is no utility class that can be used to align the headers to the right. But this can be achieved with custom CSS.

Here is a Stackblitz example that shows the approach in action.

Let us know in case additional information is needed.

Tags
Grid
Asked by
obaid
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Share this question
or