This is a migrated thread and some comments may be shown as answers.

To get the orderId of the proper order is?

1 Answer 78 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Ikou
Top achievements
Rank 1
Ikou asked on 21 Jan 2016, 09:48 AM

Hi. 
Task is I want to get the orderId the appropriate value is entered when it is added.
rather than the appropriate value be acquired orderId at the timing of the add, 0 Contains.
Is there get the appropriate value has entered orderId at the timing of the add?

 

$("#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")
    }
  ],
  add: function(e) {
    console.log(e.task.orderId); // If you want to output a 1 is output is zero
  }
});

 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar Terziev
Telerik team
answered on 22 Jan 2016, 07:21 AM
Hello,

The 'add' event is fired before the newly created gantt task is added to the dataSource and since the orderId is calculated after the task is added to the dataSource, thus its value is always "0", which is the default value. In order to obtain the orderId of the newly added tasks, the following code snippet could be used:
var newTaskUid;
 
       $("#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")
               }
           ],
           add: function(e) {
               newTaskUid = e.task.uid;
           },
           dataBound: function(e) {
               var newTask = this.dataSource.getByUid(newTaskUid);
 
               if (newTask) {
                   console.log(newTask.orderId);
               }
           }
       });


Regards,
Dimitar Terziev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Gantt
Asked by
Ikou
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or