Changing grouping & view in one action calls custom data manager more than once, creates duplicates

I have a strange situation.  I have a custom data manager that I am using to bind my scheduler to:

                            <ScheduleEventSettings TValue="JobAssignment" EnableTooltip="@TooltipEnable" Query="@ScheduleQuery">
                                <SfDataManager Adaptor="Adaptors.CustomAdaptor">
                                    <JobAssignmentAdaptor></JobAssignmentAdaptor>
                                </SfDataManager>

This is working great.  Now I want to create a toolbar button that allows me to change from timeline day view which is my default view, to the month view without the timeline.  So my method for clicking the month button looks like this:

    private void OnMonthView()
    {
        GroupData = new string[] { };
        this.CurrentView = View.Month;
    }

It does remove the grouping and also changes the view to the month view, but the "ReadAsync" action of the custom datamanager is being called twice and every entry is duplicated on the scheduler!  Is there no way that with one button click on a toolbar I can change both the resource grouping and change the view?  Is there a way to prevent the "double" calling of the read action?  


3 Replies 1 reply marked as answer

NR Nevitha Ravi Syncfusion Team February 23, 2021 09:45 AM UTC

Hi Ben, 

Greetings from Syncfusion Support. 

We have validated the reported scenario at our end and let you know that ReadAsync will trigger twice in this case as the entire layout refreshed when changing the view as well as changing the group. So we suggest you to use view wise grouping as your requirement is to change the layout of grouping in month view alone. Please refer to the following code example and sample. 

    <ScheduleGroup Resources="@Resources"></ScheduleGroup> 
    <ScheduleViews> 
        <ScheduleView Option="View.TimelineDay"></ScheduleView> 
        <ScheduleView Option="View.Month"> 
            <ScheduleViewGroup  Resources="@ViewResources"></ScheduleViewGroup> 
        </ScheduleView> 
    </ScheduleViews> 
 
 
    public string[] Resources { get; set; } = { "Projects" }; 
    public string[] ViewResources { get; set; } = {  }; 
 
    void OnMonthClick() 
    { 
        this.CurrentView = View.Month; 
    } 


Please try the above solution and get back to us if you need any further assistance. 

Regards, 
Nevitha 


Marked as answer

BB Ben Becker February 23, 2021 01:26 PM UTC

Worked perfect, thank you!


VM Vengatesh Maniraj Syncfusion Team February 24, 2021 08:25 AM UTC

Hi Ben, 
 
You are most welcome. 
 
Please get in touch with us if you need any further assistance. 
 
Regards, 
Vengatesh  


Loader.
Up arrow icon