Hi,
I'm trying to disable taskbar editing for some rows on a condition. There is a similar question for jquery component:
https://www.syncfusion.com/forums/145210/disable-moving-with-condition
Using the information in this thread and some others, I managed to change the cursor style and hide editing elements. However, I could not disable moving. Can you help on this requirement please?
Thanks & Kind regards
|
<SfGantt @ref="Gantt" DataSource="@TaskCollection" Height="450px" Width="800px" HighlightWeekends="true"
Toolbar="@(new List<string>(){ "Add", "Edit", "Update", "Delete", "Cancel", "ExpandAll", "CollapseAll","Indent","Outdent"})"
AllowSelection="true" GridLines="Syncfusion.Blazor.Gantt.GridLine.Both" TreeColumnIndex="1"
ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd" AllowRowDragAndDrop="true">
...
<GanttEvents TValue="TaskData" QueryChartRowInfo="ChartRowInfo"></GanttEvents>
</SfGantt>
@code{
public async Task ChartRowInfo(QueryChartRowInfoEventArgs<TaskData> args)
{
dynamic data = Gantt.GetHierarchicalData(args.Data.TaskId);
if (args.Data.TaskId == 2)
{
args.Row.AddClass(new string[] { " DisableTaskbar " }); // add custom class for Taskbar
await JS.InvokeVoidAsync("GanttTaskbarMove"); // Invoke js method
}
}
...
} |
|
<script>
window.GanttTaskbarMove = () => {
setTimeout(function() {
var container = document.getElementsByClassName("DisableTaskbar")[0];
var taskbar = container.getElementsByClassName("e-taskbar-main-container")[0];
taskbar.addEventListener("mousedown", function(e) {
e.stopPropagation()}); // To restrict Taskbar editing
}, 1000);
};
</script> |
Hi Alagumeena,
I tried your solution, and it works great.
Thank you very much.
Can you please consider adding this subject as a built-in property/feature in the future versions?
Kind regards
Yunus