How to set alignment of cells in Kendo grid after formatting it
Asked Answered
C

1

6

I am using Kendo grid in my project.

I am using culture script for internationalization.

Using that script it formats the numbers in grid depending upon culture I want to align the numbers to right, how can I achieve it?

Here is a fiddle where I am formatting number column.

Cistercian answered 18/5, 2015 at 9:8 Comment(0)
S
13

You can achieve that using headerAttributes and Attributes property in the column description.

{
    field: "n",
    headerAttributes:{ style:"text-align:right"},
    attributes:{ class:"text-right" } ,
      //template: "<div style='text-align:right'>#= n #</div>",
    format: "{0:n}", type: "number"
  } 

Please see the updated fiddle here

Shanonshanta answered 19/5, 2015 at 5:58 Comment(1)
Worth a mention that class text-right is already defined in bootstrap.css, along with text-left, text-center, etc.Fieldwork

© 2022 - 2024 — McMap. All rights reserved.