Oniel Telies
Oniel Telies

Reputation: 155

Modify sorting in kendo Grid

I have a column named 'IdleTime' which has values such as '59d 173', '23d 267' ,etc which represents n days and t time. But i wanted to sort this column by UpdatedTime as while sorting it considers IdleTime to be string and so the values aren't sorted properly.

@(Html.Kendo().Grid(Model).Name("StudentModel")
    .Columns(column =>
    {
      column.Bound(p => p.ID).Width(30).EditorTemplateName("#=GetID(this)#");
      column.Bound(p => p.IdleTime).Width(30);
      column.Bound(p => p.UpdatedTime).Width(50);
    })
    .Selectable()
    .Sortable())

Upvotes: 2

Views: 629

Answers (1)

Oniel Telies
Oniel Telies

Reputation: 155

It seems like compare (in JQuery Kendo) wasn't the only way to solve this problem for kendo MVC wrapper. To achieve this, I made use of ClientTemplate

column.Bound(p => p.UpdatedTime).Width(50).ClientTemplate("#=IdleTime#");

Upvotes: 2

Related Questions