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

Nupur picture Nupur · May 18, 2015 · Viewed 16.9k times · Source

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.

Answer

Amal Dev picture Amal Dev · May 19, 2015

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