Time not sorted properly KendoUI Grid

时间:2016-07-11 18:56:53

标签: javascript kendo-ui kendo-grid

I am having an issue in sorting the dateTime for my kendoUI grid, see as my grid snapshot, the date is sorted correctly (sorted from most recent dateTime), but the time is not, where "Jul/08/2016 15:04:22" should be on the top (showed in my snapshot), could any one help with this, thank you!

My code:

self.gridDataSource = new kendo.data.DataSource({
  sort: { field: "start_time", dir: "asc" },
  schema: {
    model: {
      fields: {            
          start_time: { type: "date" },      
      }
    }
  }
});

self.myGrid = {
  selectable: true,
  resizable: true,
  sortable: true, // todo: fix sorting issue
  dataSource: self.gridDataSource,
  filterable: true,
  columns: {
        field: "start_time",
        title: "Start Time",
        width: "180px",
        filterable: false,
        template: "#= kendo.toString(kendo.parseDate(start_time), 'MMM/dd/yyyy HH:mm:ss') #",
        attributes: { style: "text-align: center; " },
        format: "{0:MM/dd/yyyy}"

  }
}

1 个答案:

答案 0 :(得分:0)

将日期格式更改为"{0:MM/dd/yyyy HH:mm:ss}"

工作example