<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>);
}
} |
<style>
.e-gantt-chart .e-left-connectorpoint-outer-div,
.e-gantt-chart .e-right-connectorpoint-outer-div
{
display: none !important;
}
</style> |
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
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.
Code snippets of Gantt rendering code in your application.
Modify the attached sample as issue replicable, if possible.