Complete demo in documentation demo

Is there a complete Blazor project code for this demo? I suspect the split task function failed.

https://blazor.syncfusion.com/documentation/gantt-chart/split-task#segment-customization-with-template


I found this  https://github.com/SyncfusionExamples/customizable-task-editor-in-blazor-gantt , but it cannot show this exact result:

I know that is using an old version of Blazor, but I do not mind.


Image_3423_1721444906110


5 Replies

AG Ajithkumar Gopalakrishnan Syncfusion Team July 22, 2024 02:43 PM UTC

Hi Desmond,

Greetings from Syncfusion Support,

Regarding your query, we have prepared sample based on shared UG reference and as per attached image we have added task Label along with it. We have included the task label in the sample and have attached the code snippet below for your reference.

<SfGantt @ref="gantt">

   

    <GanttTemplates TValue="TaskData">

        <TaskbarTemplate>

            @{

               

               @if (segments != null && segments.Count() > 1)

                {

                    foreach (var segment in segments)

                    {

                        string textContent = "Segment " + (segment.SegmentIndex + 1);   

                            <div class="e-gantt-child-progressbar-inner-div e-gantt-child-progressbar" style="height:24px;width:@(segment.ProgressWidth + "px");border-radius: 0px;text-align: right;">

                                <div style=@("height:22px;position: absolute;line-height:21px;font-size: 11px;color: #fff;text-overflow:ellipsis;overflow-x:hidden;")>

                                    <span>@textContent</span>

                                </div>

                            </div>

                           

                           

                        </div>

                    }

                }

               

           }

        </TaskbarTemplate>

    </GanttTemplates>

</SfGantt>


Sample link: https://blazorplayground.syncfusion.com/embed/rXLpZQVVyMLxlrhz?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

A screenshot of a computer

Description automatically generated

If you have any further questions or need additional assistance, please let me know!

Regards,

Ajithkumar G



DE desmond July 23, 2024 10:56 PM UTC

May I know if it is possible to do the same thing in v20.3.47? Coz GetRowTaskModel() is not available in that version.

If I must upgrade, can I get a zip file demo of the demo you made, in NET6.0, coz I get the error:

Microsoft.JSInterop.JSException: Could not find 'sfBlazor.Tooltip.showTooltip' ('sfBlazor' was undefined).



AG Ajithkumar Gopalakrishnan Syncfusion Team July 24, 2024 01:39 PM UTC

Hi Desmond,

Yes,
you need to update the Gantt version because split task support has been provided in 25.1.35 version.  So upgrade to minimal of 25.1.35 or 26.1.42 version. And also we have attached release notes refer it.

Release notes: https://blazor.syncfusion.com/documentation/release-notes/25.1.35?type=all#features-10

We have prepared the Gantt chart with
.net6. We have attached sample for reference. The reported issue may occurs when script not properly applied in your project. We have attached UG document refer it.

//_Layout.cshtml
<head>

   

   <link rel="stylesheet" rel='nofollow' href=https://cdn.syncfusion.com/blazor/26.1.42/styles/fabric.css />

    <script src=https://cdn.syncfusion.com/blazor/26.1.42/syncfusion-blazor.min.js type="text/javascript"></script>

</head>

//index.html
<SfGantt @ref="gantt>

    ..

</SfGantt>

@code {
  …

}


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SplitTask-688449203.zip

For more information, you may refer to the following link:

https://blazor.syncfusion.com/documentation/gantt-chart/getting-started

If you have any further questions or need additional assistance, please let me know!

Regards,
Ajithkumar G



DE desmond July 26, 2024 02:44 PM UTC

Thanks for your zip file. On top of this question, may I know if there is a simple way to handle CRUD of segments and taskbars at the same time? SegmentChanging="SegmentEventHandler" only allows CRUD of segments, what about the taskbars, shall I use OnActionComplete or what to do CRUD of taskbars?



AG Ajithkumar Gopalakrishnan Syncfusion Team July 26, 2024 03:40 PM UTC

Hi Desmond,

To achieve your requirements, we suggest to use the SegmentChanging and TaskbarEdited events in the Gantt chart. When a segment in the taskbar is edited, the SegmentChanging event is triggered. Additionally, the TaskbarEdited event is triggered for overall taskbar changes, as well as for normal taskbar edits. We have attached a code snippet and a link to the user guide for reference.

<SfGantt @ref="gantt" TValue="TaskData"ProjectEndDate="projectEnd">

   

    <GanttSegmentFields SegmentChanging="SegmentEventHandler"></GanttSegmentFields>

   

    <GanttEvents TaskbarEdited="TaskbarEdited" TValue="TaskData"></GanttEvents>

</SfGantt>

private async Task SegmentEventHandler(SegmentEventArgs<SegmentModel> args)

{

       

}

public void TaskbarEdited(TaskbarEditedEventArgs<TaskData> args)

{

    // Here, you can get the error details in the args.

}


For more information, you may refer to the following link:

https://blazor.syncfusion.com/documentation/gantt-chart/events#taskbaredited


https://blazor.syncfusion.com/documentation/gantt-chart/split-task#segment-event

If you have any further questions or need additional assistance, please let me know!


Regards,
Ajithkumar G


Loader.
Up arrow icon