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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Disable moving with condition

Thread ID:

Created:

Updated:

Platform:

Replies:

145210 Jun 12,2019 01:33 PM UTC Jun 14,2019 02:22 PM UTC jQuery 3
loading
Tags: ejGantt
Tomasz Tomczykiewicz
Asked On June 12, 2019 01:33 PM UTC

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

Jesus Arockia Sankaran S [Syncfusion]
Replied On 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 


Tomasz Tomczykiewicz
Replied On 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?

Jesus Arockia Sankaran S [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon