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

How to disable change taskbar duration by dragging

Hi,

I want to disable change taskbar duration by dragging but keep enabling change date by dragging.
Please let me know if it is possible.


Just for reference:
Taskbar Editing

Thanks in advance,

Ryosei

7 Replies

SD Saranya Dhayalan Syncfusion Team October 18, 2019 11:33 AM UTC

Hi Ryosei, 
 
Thank you for contacting Syncfusion support 
 
By using taskbarediting event we can restrict the duration update on resizing. We can set args.cancel as true when taskbarEditAction is LeftResizing or RightResizing. 
We can also hide taskbar resizing element by over-riding the CSS. 
 
Please find the below code example. 
 
<style> 
      .e-gantt-chart .e-taskbar-right-resizer.e-icon.e-right-resize-gripper, 
      .e-gantt-chart .e-taskbar-left-resizer.e-icon.e-left-resize-gripper 
      { 
        display: none; 
      } 
</style> 
        export class Editing extends SampleBase { 
            //... 
            taskbarEditing(args) { 
                if (args.taskBarEditAction == "LeftResizing" || args.taskBarEditAction == "RightResizing") { 
                    args.cancel = true 
                } 
            } 
            render() { 
                return (<div className='control-pane'> 
                 <GanttComponent id='Editing' dataSource={editingData} 
                            taskbarEditing={this.taskbarEditing.bind(this)}> 
                        //... 
                        </GanttComponent> 
                </div>); 
            } 
        } 
 
For your convenience we have prepared a sample. Please find the below sample link.  
 
 
Could you please check the above sample and get back to us if you need further assistance on this? 
 
 
Regards, 
Saranya D 



RY Ryosei Yawata October 26, 2019 05:43 AM UTC

Hi Saranya,

Thank you for quick response and sample code in detail.

Could you tell me class name to hide Connector point as well?
It's also okay that just let me know the document URL getting the info.

Best Regards,

Ryosei


JS Jonesherine Stephen Syncfusion Team October 28, 2019 07:41 PM UTC

Hi Ryosei, 
 
Using ‘e-left-connectorpoint-outer-div’ and ‘e-right-connectorpoint-outer-div’ we can hide the connector point in Gantt taskbar. 
Please find the code example below: 
<style>       
      .e-gantt-chart .e-left-connectorpoint-outer-div, 
      .e-gantt-chart .e-right-connectorpoint-outer-div 
      { 
        display: none !important; 
      } 
</style> 
We have also prepared the sample based on this. Please find the sample from below location 
 
Please let us know if you need further assistance on this. 
Regards, 
Jone sherine P S 



RY Ryosei Yawata October 29, 2019 12:11 AM UTC

Hi Joensherine,

Thank you!It works.

Regards,

Ryosei


PP Pooja Priya Krishna Moorthy Syncfusion Team October 29, 2019 04:21 PM UTC

Hi Ryosei, 
 
Thanks for the update. Please get back to us if you require further assistance on this. 
 
Regards, 
Pooja Priya K. 



JD Jason Delladecimas replied to Jonesherine Stephen January 11, 2023 02:38 PM UTC

Hi Team,

We tried hiding the right and left connectors to prevent users from editing dates on some occasions but then we get the below error on the console.

core.mjs:6494 ERROR TypeError: Cannot read properties of undefined (reading 'ganttProperties')

at TaskbarEdit.updateTaskBarEditElement (ej2-gantt.es2015.js:16236:39)





It would be very useful to be able to control individual taskbar controls from config.

For example, we have a workflow with multiple tasks.

A task can be in various states. eg Ready To Start, Started and Finished.

If the task is Ready to Start then the user can edit both start and end dates.

If it is Started then the user can only edit the end date.

If it Finished, then no dates can be edited.


Let me know if the above makes sense. 

Thanks



GM Gopinath Munusamy Syncfusion Team January 17, 2023 09:08 AM UTC

Jason, we have created a sample to demonstrate how to hide connector lines based on task states using the queryTaskbarInfo event. In this sample, we used a custom field to keep track of the state of the task and then hide the connector lines based on that state. However, we were unable to replicate the issue you reported. We have attached the sample and code snippets for your reference. Check the below sample and code snippets for more details.

Code Snippets:

[App.tsx]

const queryTaskbarInfo = (args: any) => {

    if (!args.data.hasChildRecords) {

      if (args.data.taskData.custom == 'Started') {

        args.taskbarElement.getElementsByClassName('e-left-connectorpoint-outer-div')[0].style.display = 'none';

      }

      if (args.data.taskData.custom == 'Finished') {

        args.taskbarElement.getElementsByClassName('e-left-connectorpoint-outer-div')[0].style.display = 'none';

        args.taskbarElement.getElementsByClassName('e-right-connectorpoint-outer-div')[0].style.display = 'none';

      }

    }

  };

<GanttComponent ref={(gantt) => (ganttInst = gantt)}

        queryTaskbarInfo={queryTaskbarInfo}>


Sample: https://stackblitz.com/edit/react-ts-twcuql?file=data.js,App.tsx


If still you are facing this issue, we request you to share below details, which will be useful for us to provide you with a better solution.

  1. Code snippets of Gantt rendering code in your application.

  2. Modify the attached sample as issue replicable, if possible.


Loader.
Live Chat Icon For mobile
Up arrow icon