This is a migrated thread and some comments may be shown as answers.
How to disable drag and drop option for gantt chart
4 Answers 70 Views
This is a migrated thread and some comments may be shown as answers.
developer
Top achievements
Rank 1
developer asked on 27 Apr 2016, 06:36 AM

Hi..

I'm using kendo gantt chart in my project using anular js,how can i disable drag and drop option

here is the my code 

view : 
            <div id="activityganttchart" kendo-gantt k-options="createScheduleStep2.ganttOptions" class="row"
                 k-rebind="createScheduleStep2.ganttOptions"></div>

controller:

                productionScheduleStep2Vm.ganttOptions = getActivitiesToDisplayOnGanttChart(activities);
                productionScheduleStep2Vm.ganttOptions.edit = edit;
                productionScheduleStep2Vm.ganttOptions.moveStart = ganttMove;

           function processActivitiesToDisplayGanttChart(data: any) {
                var activityList = new Array();
                for (var i = 0; i < data.length; i++) {
                    var uomName = "";
                    if (data[i].pitOutputActivity.activityValueUOMId && data[i].pitOutputActivity.activityValueUOM !== undefined) {
                        uomName = data[i].pitOutputActivity.activityValueUOM.name;
                    }
                    var activity = {
                        ID: data[i].pitOutputActivity.id,
                        Title: data[i].pitOutputActivity.activity.name,
                        Start: '\/Date(' + (+new Date(data[i].pitOutputActivity.startDate + " " + data[i].pitOutputActivity.startTime)) + ')\/',
                        End: '\/Date(' + (+new Date(data[i].pitOutputActivity.endDate + " " + data[i].pitOutputActivity.endTime)) + ')\/',
                        target: data[i].pitOutputActivity.activityValue + " " + uomName,
                        activityId: data[i].pitOutputActivity.activityId,
                        shift: data[i].pitOutputActivity.pitOutputActivityPartA.shift,
                        pitOutputActivityUUID: data[i].pitOutputActivity.pitOutputActivityUUID,
                        percentComplete: data[i].progress === "NaN" ? 0 : data[i].progress,
                        planned: data[i].planned,
                        actual: data[i].actual,
                        variance: data[i].variance,
                        assetCount: data[i].assetCount
                    }
                    activityList.push(activity);
                }
                return activityList;
            };


            function edit(e) {
                productionScheduleStep2Vm.selectedActivity = e.task;
                win = $("<div class='ganntPopup' />").kendoWindow({
                    title: "Manage Activity",
                    resizable: false,
                    modal: true,
                    pinned: true,
                    position: { top: 100 }
                });
                e.preventDefault();
                var template = createScheduleStep2Helpers.compileAngularContent($("#activityMenu").html(), $scope, $compile);
                win.data("kendoWindow").content(template).center().open();
            };

            function ganttMove(e) {
                console.log(kendo.format("task's curren Start {0:g}", e.start));
                console.log(kendo.format("task's curren End {0:g}", e.end));
                e.preventDefault();
            };

 

i tried with moveStart  event still im able to dran and drop

Appreciate your support!
Thanks!

 

4 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 28 Apr 2016, 11:48 AM
Hi,

Here is a dojo snippet showing how to disable the drag to reorder functionality of the Gantt widget.

Regards,
Dimitar Terziev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
developer
Top achievements
Rank 1
answered on 28 Apr 2016, 01:31 PM

Hi..

Thanks for u r reply,

i'm able to drag and drop the tasks in provided example, i wanted to disable drag and drop completely

 

0
Dimitar Terziev
Telerik team
answered on 28 Apr 2016, 03:07 PM
Hi,

The provided sample disables the action executed after the drop. Currently, there is no available API to disable the drag functionality.

Regards,
Dimitar Terziev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Manoj
Top achievements
Rank 1
answered on 24 Oct 2018, 04:00 AM

Generate task list starting with orderid 1.

Dragging item fires the on save event 

function onSave(e) {
    if (e.task.get("OrderId") == 0) {
    e.preventDefault();
    return false;
}

This can prevent item drag drop. Hope it helps somebody

 

Tags
Gantt
Asked by
developer
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
developer
Top achievements
Rank 1
Manoj
Top achievements
Rank 1
Share this question
or