Gantt ExpandState

HI !

The Gantt ExpandState property would be very useful if it worked as shown in the quick description.

But even if we define a source field, no value is visible in it.


Searching the user documentation for ExpandState :

There are a total of 3 results, but none with a description...

How does it work ? and where can we find a description?

Thank you in advance for your help!




6 Replies

AG Ajithkumar Gopalakrishnan Syncfusion Team June 20, 2023 12:59 PM UTC

Hi Szoke,

We have reviewed your query regarding the ExpandState property in Gantt. The ExpandState property is designed to control the initial expansion or collapse state of parent tasks in the Gantt chart. By setting the ExpandState property in the data source, you can define whether a parent task should be expanded or collapsed when the chart is loaded.


To use the ExpandState property, you need to update the corresponding boolean value in your data source for each parent task. We have provided a code snippet and a sample that demonstrates how to use the ExpandState property effectively.

<SfGantt @ref="Gantt" DataSource="@TaskCollection" >

    <GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress"

                     Dependency="Predecessor" ParentID="ParentId" ExpandState="Expandstate"></GanttTaskFields>

……

</SfGantt>


public class TaskData
{

     public int TaskId { get; set; }

     …..

     public bool Expandstate { get; set; }
}


public static List<TaskData> EditingData()

        {

            List<TaskData> Tasks = new List<TaskData>() {

        new TaskData() {

            TaskId = 1,

            TaskName = "Product concept",

            StartDate = new DateTime(2021, 04, 02),

            EndDate = new DateTime(2021, 04, 08),

            Duration = "5 days",

            Expandstate = false

        },

        ……

       new TaskData() {

            TaskId = 6,

            TaskName = "Market research",

            StartDate = new DateTime(2021, 04, 09),

            EndDate = new DateTime(2021, 04, 18),

            Predecessor="2",

            Duration = "4",

            Progress = 30,

            Expandstate = false

        },

        …..

        new TaskData() {

            TaskId = 13,

            TaskName = "Product design and development",

            StartDate = new DateTime(2021, 04, 19),

            EndDate = new DateTime(2021, 05, 16),

            Duration="20",

            Predecessor="6",

            Expandstate = true

         },

        ….

   };

            return Tasks;

        }


Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ExpandState877032741

We apologize for the lack of documentation regarding the ExpandState property. We will ensure that the related user guide documentation is updated to include a detailed description of its functionality.

Regards,
Ajithkumar G



SZ Szoke June 20, 2023 04:49 PM UTC

Dear Ajithkumar!


Thanks for your response !


What is the solution if we want to save the current status of tasks in a database with a custom data adapter?



AG Ajithkumar Gopalakrishnan Syncfusion Team June 21, 2023 02:35 PM UTC

Hi Szoke,

To achieve your requirement, we have use the Expanded and Collapsed events. In these events, you can capture the updated value of args.Data, which represents the current state of the tasks, and then save it to your database through your custom data adapter. In We have prepared a sample and attached it along with a code snippet for your reference.


<SfGantt @ref="GanttChart" ID="GanttChart" EnableContextMenu TValue="SelfReferenceData"  AllowRowDragAndDrop LoadChildOnDemand >

    <SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>

    ……

    <GanttEvents TValue="SelfReferenceData" Expanded="ExpandedHandler" Collapsed="Collapsed"></GanttEvents>

</SfGantt>


 

    public void ExpandedHandler(RowExpandedEventArgs<SelfReferenceData> args)

    {

        // Here, you can customize your code.

        var data = Gantt.Where(or => or.TaskID == args.Data.TaskID).FirstOrDefault();

        if (data != null)

        {

            data.IsExpand = args.Data.IsExpand;

        }

    }

 

    public void Collapsed(RowCollapsedEventArgs<SelfReferenceData> args)

    {

        // Here, you can customize your code.

        var data = Gantt.Where(or => or.TaskID == args.Data.TaskID).FirstOrDefault();

        if (data != null)

        {

            data.IsExpand = args.Data.IsExpand;

        }

    }


Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Adaptor750944956

If you have any further questions or need additional assistance, please feel free to let us know.

Regards,
Ajithkumar G



SZ Szoke June 23, 2023 08:53 AM UTC

Dear Ajithkumar!

Thanks for your response !


The question is how the ExpandAll, CollapseAll commands should be handled.

Now we find that the ExpandAll command runs on the ExpandedHandler, but args=null.


Waiting for your reply, regards:


Szőke L.




AG Ajithkumar Gopalakrishnan Syncfusion Team June 26, 2023 01:56 PM UTC

Hi Szoke,

We are able to replicate the issue at our end.


On further validation, we have considered the reported issue (“Expanded/Collapsed event returns null when toolbar is using the expand/collapse all actions”) as a bug. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and will include the fix in our upcoming patch release which is expected to be rolled out on July 19, 2023. Until then we appreciate your patience.


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through the below feedback link, 

  

Feedback link: https://www.syncfusion.com/feedback/44790/expanded-collapsed-event-returns-null-when-toolbar-is-using-the-expand-collapse


Note: To view the above feedback, kindly login into your account. 


Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization

Regards,
Ajithkumar G



AG Ajithkumar Gopalakrishnan Syncfusion Team July 19, 2023 09:31 AM UTC

Hi Szoke,


We are glad to announce that fix for the issue “Expanded/Collapsed event returns null when toolbar is using the expand/collapse all actions” has been rolled out in our Nuget release (22.1.39).  So please upgrade to our latest version of Syncfusion package to resolve the reported issue.  Please find the Nuget package for latest fixes and features from below.

Nuget :  https://www.nuget.org/packages/Syncfusion.Blazor.Gantt

Release notes: Essential Studio for Blazor Weekly Nuget Release Release Notes (syncfusion.com)


Regards,

Ajithkumar G


Loader.
Up arrow icon