Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 242
Nupur Avatar asked May 18 '15 09:05

Nupur


People also ask

How do I fix a column in Kendo grid?

The Kendo UI grid widget supports static/frozen columns by a single configuration setting. Simply set the locked attribute of the corresponding column to true, and this will bring the column in the locked columns group positioned on the left in the grid.

What is Pageable in kendo grid?

kendo:grid-pageable-messagesThe text messages displayed in pager. Use this option to customize or localize the pager messages.

What is dataItem in kendo grid?

Returns the data item to which the specified table row is bound. The data item is a Kendo UI Model instance.


1 Answers

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

like image 129
Amal Dev Avatar answered Sep 30 '22 02:09

Amal Dev