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

Prevent Specific Columns from Reordering in the Gantt Treelist

Environment

Product Progress® Kendo UI® Gantt for jQuery

Description

How can I prevent a specific Gantt column from reordering?

Solution

To achieve the desired scenario, use the reorderColumn of the integrated TreeList to move the column back.

    <div id="gantt"></div>
    <script>
      var nonReordableColumn;

      var gantt = $("#gantt").kendoGantt({
        columns: ["title", "start", "end"],
        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")
        }],

        dataBound: function(e){
          nonReordableColumn = e.sender.list.columns[0];
        },
        reorderable: true,
        columnReorder: function(e) {
          if(e.column.title === nonReordableColumn.title){
            setTimeout(function(){
              var ganttList = $(".k-treelist").data("kendoGanttList");
              ganttList.reorderColumn(0, nonReordableColumn)
            },1)

          }
        }
      }).data("kendoGantt");
    </script>

See Also

In this article