This is a migrated thread and some comments may be shown as answers.

How to Right align numeric field in the grid.

3 Answers 2348 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mukesh
Top achievements
Rank 1
Mukesh asked on 05 Aug 2019, 09:58 AM

     I want to right align all my column having numeric value nut i did not found any property on GridColumnProps.

Is there any way to do that.

3 Answers, 1 is accepted

Sort by
0
Arun
Top achievements
Rank 1
answered on 06 Aug 2019, 02:17 AM

You can add a custom className or a style to the column by checking the type.

 

https://stackblitz.com/edit/react-valgmy-ams1qs?file=app/main.jsx

0
Mukesh
Top achievements
Rank 1
answered on 06 Aug 2019, 09:50 AM

I need a simple property on grid which should understand supplied field as number and it should right align that.

This is simple standard which every one follows today, I don'r want to loop through all my column collection and explicitly set that style. 

0
Stefan
Telerik team
answered on 07 Aug 2019, 06:19 AM
Hello, Mukesh,

Setting the numbers fields by default to the right based on number option, could causes issue as not in every case the developer will want the numbers to be right aligned.

Also, there is no need to loop through the data. I can suggest making a NumerCell component, that will align the numbers and that component can be reused across many Grids:

https://stackblitz.com/edit/react-qnpjx9?file=app/main.jsx

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Bin
Top achievements
Rank 1
commented on 02 Dec 2022, 05:04 PM

Hi Stefan,

The Grid column header th is still left aligned. Any suggestion to right aligned th too?

Thanks

Bin
Top achievements
Rank 1
commented on 04 Dec 2022, 10:20 PM

No worries. I just found this class headerClassName
Tags
General Discussions
Asked by
Mukesh
Top achievements
Rank 1
Answers by
Arun
Top achievements
Rank 1
Mukesh
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or