Skip to content

4. Column Settings

Emrah KONDUR edited this page Dec 17, 2022 · 8 revisions

Title

Set column header. Default is property name.

.Title("Person Name");

Or use DisplayAttribute for properties.

[Display(Name = "Person Name")]
public string Name { get; set; }

Format

Customize datetime format with Moment.js expression.

.Format("DD-MMM-Y");

Or use DisplayFormatAttribute for properties.

[DisplayFormat(DataFormatString = "DD-MMM-Y")]
public DateTime? BirthDate { get; set; }

Template

Manipulate and change display of column according to data.

.Template("(data === true) ? '<span class=\"glyphicon glyphicon-ok\"></span>' : '<span class=\"glyphicon glyphicon-remove\"></span>'");

Visible

Set column visible or hidden, default is true.

.Visible(false);

Searchable

Set column searchable or not, default is true.

.Searchable(false);

Orderable

Set column orderable or not, default is true.

.Orderable(false);

Width

Set column width percentage.

.Width(50);

Class

Set css class of column.

.Class("text-danger");

DefaultContent

Set default value for null data.

.DefaultContent("No Data");
Clone this wiki locally