We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Disable moving with condition

Hi,

I have allowGanttChartEditing sets to true. I want to disable the moving task/milestones with a specific condition (for example if id equals 5). How can I achieve this?

Best regards,
Tomasz Tomczykiewicz

3 Replies

JA Jesus Arockia Sankaran S Syncfusion Team June 13, 2019 07:29 AM UTC

Hi Tomasz, 
 
Greetings from Syncfusion support. 
 
We can disable the editing action of specific taskbar by using taskbarEditing event, and we set args.cancel to true for particular records in order to cancel the editing action as mentioned in the below code snippet. 
 
Code Snippet: 
 
 
$("#GanttContainer").ejGantt({ 
            //... 
            taskbarEditing: function (args) { 
                if (args.rowData.taskId == 5) { 
                    args.cancel = true 
                } 
            } 
        }); 
 
 
Please get back to us if you require further assistance on this. 
 
Regards, 
Jesus Arockia Sankaran S 



TT Tomasz Tomczykiewicz June 13, 2019 07:41 AM UTC

Thanks for the answer. But when you hover the taskbar with id equals 5 in your demo, the cursor changes to the move cursor and this indicates that you can move the task. I don't want to have the move cursor on task with id 5. Can you disable it?


JA Jesus Arockia Sankaran S Syncfusion Team June 14, 2019 02:22 PM UTC

Hi Tomasz, 
 
We can hide taskbar editing element and change the cursor type by using CSS styles. We can add class to the particular taskbar by using queryTaskbarInfo event. 
By using that class we can hide taskbar editing elements,  please find the code example below. 
 
<style> 
    .e-ganttchart .e-prevent-edit .e-gantt-childtaskbar { 
        cursor: auto !important 
    } 
 
    .e-ganttchart .e-prevent-edit .e-gripper { 
        content: none !important; 
        display: none; 
    } 
 
    .e-ganttchart .e-prevent-edit .e-progressbarhandler, 
    .e-ganttchart .e-prevent-edit .e-connectorpoint-hover { 
        display: none; 
    } 
</style> 
 
 
<script> 
    $("#GanttContainer").ejGantt({ 
        //... 
        queryTaskbarInfo: function (args) { 
            if (args.data.taskId == 5) { 
                $(args.taskbar).find('.e-childContainer').addClass('e-prevent-edit'); 
            } 
 
        }, 
    }); 
</script> 
 
Please find the below sample link. 
 
Please get back to us if you require further assistance on this. 
 
Regards, 
Jesus Arockia Sankaran S 


Loader.
Live Chat Icon For mobile
Up arrow icon