New to Kendo UI for jQuery? Start a free 30-day trial

Columns.sortable

configuration

If set to true the user could sort this column by clicking its header cells. By default sorting is disabled.

columns.sortable

Boolean|Object

Default: false

<div id="gantt"></div>
<script>
$("#gantt").kendoGantt({
  dataSource: [
    {
      id: 1,
      orderId: 0,
      parentId: null,
      title: "Task1",
      start: new Date("2014/6/17 9:00"),
      end: new Date("2014/6/17 11:00")
    },
    {
      id: 2,
      orderId: 1,
      parentId: null,
      title: "Task2",
      start: new Date("2014/6/17 12:00"),
      end: new Date("2014/6/17 14:00")
    },
    {
      id: 3,
      orderId: 2,
      parentId: null,
      title: "Task3",
      start: new Date("2014/6/17 13:00"),
      end: new Date("2014/6/17 15:00")
    }
  ],
  dependencies: [
    {
      predecessorId: 1,
      successorId: 2,
      type: 1
    }
  ],
  columns: [
    { field: "title", title: "Title", sortable: true }
  ]
});
</script>

A JavaScript function for comparing the values.

  • If the first argument is less than the second one, returns -1.
  • If both arguments are the same, returns 0.
  • If the first argument is greater than the second one, returns +1.
<div id="gantt"></div>
<script>
$("#gantt").kendoGantt({
  dataSource: [
    {
      id: 1,
      orderId: 0,
      parentId: null,
      title: "TaskOne",
      start: new Date("2014/6/17 9:00"),
      end: new Date("2014/6/17 11:00")
    },
    {
      id: 2,
      orderId: 1,
      parentId: null,
      title: "Task2",
      start: new Date("2014/6/17 12:00"),
      end: new Date("2014/6/17 14:00")
    },
    {
      id: 3,
      orderId: 2,
      parentId: null,
      title: "TaskLongTitle",
      start: new Date("2014/6/17 13:00"),
      end: new Date("2014/6/17 15:00")
    }
  ],
  dependencies: [
    {
      predecessorId: 1,
      successorId: 2,
      type: 1
    }
  ],
  columns: [
    {
      field: "title",
      title: "Title",
      sortable: {
        compare: function(a, b) {
          return a.title.length - b.title.length;
        }
      }
    }
  ]
});
</script>