We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Scheduler SelectedDateChanged duplicate notifications

I'm trying to use the SelectedDateChanged() event but I get two callbacks each time the user changes date.
The first callback has the correct value (the newly selected date), the second call indicates the date the schedule was initialised with.

I'm new to Blazor and the SyncFusion - am I missing something obvious here or is this a bug?

Here is an example based on your LocalData sample:

<div class="col-lg-12 control-section">
    <div class="schedule-wrapper">
        <EjsSchedule @ref="ScheduleObj" @ref:suppressField TValue="AppointmentData" Width="100%" Height="650px" SelectedDate="@(new DateTime(2019, 1, 10))" SelectedDateChanged="@SelectedDateChanged">
            <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>
        </EjsSchedule>
    </div>
</div>

@code{
      protected void SelectedDateChanged(DateTime dt)
    {
        System.Console.WriteLine($"Date change event {dt.ToString()}");
    }
}


Console Output:
blazor.webassembly.js:1 Blazor is running in dev mode without IL stripping. To make the bundle size significantly smaller, publish the application or see https://go.microsoft.com/fwlink/?linkid=870414
blazor.webassembly.js:1 Debugging hotkey: Shift+Alt+D (when application has focus)
blazor.webassembly.js:1 WASM: GC_MAJOR_SWEEP: major size: 9328K in use: 13098K
blazor.webassembly.js:1 WASM: GC_MAJOR: (LOS overflow) time 25.19ms, stw 25.59ms los size: 6176K in use: 3493K
ej2.min.js:1 Uncaught TypeError: Cannot read property 'querySelector' of null
    at N (ej2.min.js:1)
    at t.setActiveBorder (ej2.min.js:1)
    at t.refreshActiveBorder (ej2.min.js:1)
    at t.refreshActElePosition (ej2.min.js:1)
blazor.webassembly.js:1 WASM: Date change event 17/01/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 10/01/2019 00:00:00
blazor.webassembly.js:1 WASM: GC_MINOR: (Nursery full) time 3.64ms, stw 3.69ms promoted 393K major size: 9408K in use: 3182K los size: 7200K in use: 6731K
blazor.webassembly.js:1 WASM: Date change event 24/01/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 10/01/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 31/01/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 10/01/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 07/02/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 10/01/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 14/02/2019 00:00:00
blazor.webassembly.js:1 WASM: Date change event 10/01/2019 00:00:00




8 Replies

JC James Cockerill August 25, 2019 12:28 PM UTC

Also, are there any events when a user selects an event or selects blank cells in the schedule?

Currently if they select a single blank cell the new event dialog opens - I'd like to do this if they drag-select multiple cells and pre-populate the start time and duration accordingly (similar to the way google calendar works).
I also need to change other properties on the page based on any selected event - but can't see any samples/documentation demonstrating this.



CW Christoph Weller August 25, 2019 04:29 PM UTC

Hello James,

I had an similar issue with Dropdownlists. From your defintion :

<EjsSchedule @ref="ScheduleObj" @ref:suppressField TValue="AppointmentData" Width="100%" Height="650px" SelectedDate="@(new DateTime(2019, 1, 10))" SelectedDateChanged="@SelectedDateChanged">

when you remove the 'SelectedDate="@(new DateTime(2019, 1, 10))"' then i bet the event will only called once with the right value.

Regards
Christoph Weller


JC James Cockerill August 25, 2019 04:38 PM UTC

Thanks, I expect so but then how do you set the initial date?
I tried binding it to a variable instead of a hardcoded value (i.e. @CurrentDateTime) but that didn't help.
I still get two events and the binding isn't two-way either.


CW Christoph Weller August 26, 2019 08:32 AM UTC

Hello James,

To set the inital value, insert into your EjsSchedule definition an @ref="MyScheduler" and then in the OnInitialized() method set the value
by 'MyScheduler.SelectedValue = new DateTime(2019,1,10)'.

Regards
Christoph Weller


NR Nevitha Ravi Syncfusion Team August 26, 2019 10:40 AM UTC

Hi James, 

Greetings from Syncfusion Support. 

The reported issue with SelectedDate property has been already logged which can be tracked from the following link. 

The issue fix will be included in our upcoming bi-weekly patch release expected to be rolled out on first week of September. We request your patience until then. 

Regards, 
Nevitha. 



JC James Cockerill August 26, 2019 03:39 PM UTC

Understood. Thanks I'll wait for the bugfix.

Is there any event when a user selects multiple blank cells or an actual event?

Currently if they select a single blank cell the new event dialog opens - I'd like to do this if they drag-select multiple cells and pre-populate the start time and duration accordingly (similar to the way google calendar works).
I also need to change other properties on the page based on any selected event - but can't see any samples/documentation demonstrating this.


NR Nevitha Ravi Syncfusion Team August 27, 2019 09:03 AM UTC

Hi James, 

Thanks for your update. 

Q: Is there any event when a user selects multiple blank cells? 
Currently we don’t have support to open Quick info popup on multiple cell selection, as it is a valid feature we considered this as an improvement and logged the feature request which can be tracked from the following link. This will be implemented and included in any of our upcoming releases. 

Q: Is there any event when a user selects an actual event? 
Yes, OnEventClick will trigger when we select or click an appointment. Please refer the following code for the same. 

<EjsSchedule TValue="AppointmentData" Height="650px"> 
    <ScheduleEvents TValue="AppointmentData" OnEventClick="OnEventSelected"></ScheduleEvents> 
</EjsSchedule> 
   
@code{ 
    protected void OnEventSelected(EventClickArgs<AppointmentData> args) 
    { 
    } 
} 

Regards, 
Nevitha. 



NR Nevitha Ravi Syncfusion Team September 3, 2019 04:54 PM UTC

Hi James, 

Thanks for being patience. 

The reported issue with SelectedDate property has been fixed and included in our latest release v17.2.49. Kindly upgrade your version to avail the fix. 

Regards, 
Nevitha 


Loader.
Live Chat Icon For mobile
Up arrow icon