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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Scheduler SelectedDateChanged duplicate notifications

Thread ID:

Created:

Updated:

Platform:

Replies:

146901 Aug 24,2019 10:12 PM UTC Sep 3,2019 04:54 PM UTC Blazor 8
loading
Tags: Scheduler
James Cockerill
Asked On August 24, 2019 10:12 PM UTC

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




James Cockerill
Replied On 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.


Christoph Weller
Replied On 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

James Cockerill
Replied On 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.

Christoph Weller
Replied On 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

Nevitha Ravi [Syncfusion]
Replied On 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. 


James Cockerill
Replied On 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.

Nevitha Ravi [Syncfusion]
Replied On 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. 


Nevitha Ravi [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon