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

How to make some tasks uneditable and others editable

8 Answers 201 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Shobhit
Top achievements
Rank 1
Shobhit asked on 04 May 2015, 09:17 AM
I need to make some of the task in a Gantt Chart uneditable ( non draggable) while allowing others to be edited (can be dragged). Please help

8 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 04 May 2015, 10:13 AM
Hello,

You can use the moveStart event and call e.preventDefault() to prevent a certain task from moving.

Regards,
Bozhidar
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Shobhit
Top achievements
Rank 1
answered on 05 May 2015, 04:45 AM

Thank you very much.

Just one more question, similar to above, I need to make some of the tasks appear in the treelist view inside Gantt chart to be unsortable while others sortable.

0
Shobhit
Top achievements
Rank 1
answered on 05 May 2015, 05:00 AM
By unsortable  I mean to say they can or cannot be reordered by dragging and droping
0
Bozhidar
Telerik team
answered on 05 May 2015, 06:51 AM
Hi,

Unfortunately there isn't an event that's triggered on this action yet, so implementing this will require some coding. Here's the code you need to add to your page in order to achieve this:
var gantt = $("#gantt").data("kendoGantt");
var selector = ".k-treelist .k-grid-content table td";
$(gantt.wrapper)
    .on("mousedown", selector, function(e) {
        if ($(this).parent().attr("data-level") === "2") { // Prevent drag and drop of level 3 tasks (zero based indexing)
            $(gantt.wrapper).on("mousemove.preventDrag", selector, function(e) {
                e.stopPropagation();
            })
        }
    })
    .on("mouseup", selector, function() {
        $(gantt.wrapper).off(".preventDrag");
    });


Regards,
Bozhidar
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Shobhit
Top achievements
Rank 1
answered on 05 May 2015, 07:11 AM

thank you so much,

One more thing, how to avoid dropping of rows with data-level="0" to become the child of data-level="0" or further, so that the items with level 0 will always remain the same.

 

0
Bozhidar
Telerik team
answered on 05 May 2015, 07:49 AM
Hello,

For this you can use the save event and check the corresponding fields.

Regards,
Bozhidar
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Shobhit
Top achievements
Rank 1
answered on 05 May 2015, 09:18 AM

Thank you so much for the help,

One last question, can we change the icon "+" "-" "cross" that appears during the dragging.

Also the logic based on which these icon change

0
Bozhidar
Telerik team
answered on 06 May 2015, 07:11 AM
Hello,

The Icon is changed based on the position of the task relative to the tasks underneath it. It's controlled by a class name, which changes between the following values, which are self-explanatory:
"k-insert-top",
"k-insert-bottom",
"k-add",
"k-insert-middle",
"k-denied",

For instance the k-insert-top class is set to the icon when the task is to be added above another task.

To change the icon just use CSS and the above classes to set the background-image to your own icon.

Regards,
Bozhidar
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
Shobhit
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Shobhit
Top achievements
Rank 1
Share this question
or