GetCurrentViewDate always empty is this a known issue?

Hi,

How do we get any values back from GetCurrentViewDate?  We are selecting a week view but cannot get the start and end dates of the current view whatever we try, is this a known issue?

Thanks,
Alex

7 Replies 1 reply marked as answer

AB Atle Bjelland August 28, 2020 03:33 PM UTC

We are seeing the same issues and are right now not sure how to get the dates?

Thanks 

Atle


RV Ravikumar Venkatesan Syncfusion Team August 31, 2020 01:08 PM UTC

Hi Alex, 

Greetings from Syncfusion support. 

We have validated your reported query “GetCurrentViewDate always empty is this a known issue?” at our end. We are able to reproduce the issue that you have reported. We had logged the defect report at our end and the fix will be included in our vol 3 release which is scheduled to be rolled out at the end of September 2020. You can track this defect status in the below feedback link. We appreciate your patience. 

 
 
In the meantime we suggest you use the below workaround solution and we have prepared a sample for your reference and it can be available below. 

Step 1:  Define the SfDataManger with Custom Adaptor inside the ScheduleEventSettings element.  
Step 2:  Define ReadAsync() which performs data read operations asynchronously. In the ReadAsync method, you can able to get the scheduler start and end date for every scheduler navigations. 

[Index.razor] 
@using Syncfusion.Blazor 
@using Syncfusion.Blazor.Schedule 
@using Syncfusion.Blazor.Data 
@using Newtonsoft.Json 
@using SchedulerWebApi.Models 
 
<SfSchedule TValue="AppointmentData" Height="550px" CurrentView="View.Week" SelectedDate="@(new DateTime(2018, 4, 19))"> 
    <ScheduleEvents TValue="AppointmentData"></ScheduleEvents> 
    <ScheduleEventSettings TValue="AppointmentData"> 
        <SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager> 
    </ScheduleEventSettings> 
</SfSchedule> 
@code { 
    static HttpClient client = new HttpClient(); 
    public class CustomAdaptor : DataAdaptor 
    { 
        public async override Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null) //triggers on initial load 
        { 
            var json = await client.GetStringAsync("https://localhost:44382/api/schedule"); 
            AppointmentData[] datasource = JsonConvert.DeserializeObject<AppointmentData[]>(json); 
            foreach(string KeyValue in dataManagerRequest.Params.Keys) 
            { 
                Console.WriteLine(KeyValue + ":" + dataManagerRequest.Params[KeyValue]);  // Here you can get start and end date of the scheduler's current view 
            } 
            return dataManagerRequest.RequiresCounts ? new DataResult() { Result = datasource, Count = datasource.Count() } : (object)datasource; 
        } 
    } 
} 


Please get back to us if you need any further assistance.  

Regards,  
Ravikumar Venkatesan 



AL Alex September 3, 2020 09:14 AM UTC

Thanks for the work around.

However, using a custom DataAdapter, how do we see newly added entries?  The Scheduler doesn't seem to update even after calling refresh?

We're back to where we started.

Thanks,
Alex


RV Ravikumar Venkatesan Syncfusion Team September 4, 2020 08:27 AM UTC

Hi Alex, 

Thanks for the update. 

We have validated your reported query at our end. We suspect that you are not added the BatchUpdateAsync method in your project because that the newly added appointments are not added to the DB. So, the newly added events are not rendered in the Scheduler. To perform CRUD actions with the Scheduler you need to add the BatchUpdateAsync method in your project like the below and the same available in the below-shared sample. 
 
SchedulerCRUDSample [Index.razor] 
@code { 
    static HttpClient client = new HttpClient(); 
    public class CustomAdaptor : DataAdaptor 
    { 
        public async override Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null) //triggers on initial load 
        { 
            // ReadAsync method content 
        } 
        public async override Task<object> InsertAsync(DataManager dataManager, object data, string key) 
        { 
            // InsertAsync method content        } 
 
        public async override Task<object> UpdateAsync(DataManager dataManager, object data, string keyField, string key) 
        { 
            // UpdateAsync method content 
       } 
 
        public async override Task<object> RemoveAsync(DataManager dataManager, object data, string keyField, string key) //triggers on appointment deletion through public method DeleteEvent 
        { 
            // RemoveAsync method content 
       } 
 
        public async override Task<object> BatchUpdateAsync(DataManager dataManager, object changedRecords, object addedRecords, object deletedRecords, string keyField, string key, int? dropIndex) 
        { 
            object records = deletedRecords; 
            List<AppointmentData> deleteData = deletedRecords as List<AppointmentData>; 
            foreach (var data in deleteData) 
            { 
                var uri = "https://localhost:44382/api/schedule/" + data.Id; 
                var json = await client.DeleteAsync(uri); 
                records = deletedRecords; 
            } 
            List<AppointmentData> addData = addedRecords as List<AppointmentData>; 
            foreach (var data in addData) 
            { 
                var formContent = new FormUrlEncodedContent(new[] 
               { 
                    new KeyValuePair<string, string>("Id", data.Id.ToString()), 
                    new KeyValuePair<string, string>("Subject", data.Subject), 
                    new KeyValuePair<string, string>("StartTime", data.StartTime.ToString()), 
                    new KeyValuePair<string, string>("EndTime", data.EndTime.ToString()), 
                    new KeyValuePair<string, string>("RecurrenceID", data.RecurrenceID.ToString()), 
                    new KeyValuePair<string, string>("RecurrenceRule", data.RecurrenceRule), 
                    new KeyValuePair<string, string>("RecurrenceException", data.RecurrenceException), 
                    new KeyValuePair<string, string>("IsAllDay", data.IsAllDay.ToString()) 
                }); 
                var json = await client.PostAsync("https://localhost:44382/api/schedule", formContent); 
                records = addedRecords; 
            } 
            List<AppointmentData> updateData = changedRecords as List<AppointmentData>; 
            foreach (var data in updateData) 
            { 
                var formContent = new FormUrlEncodedContent(new[] 
               { 
                    new KeyValuePair<string, string>("Id", data.Id.ToString()), 
                    new KeyValuePair<string, string>("Subject", data.Subject), 
                    new KeyValuePair<string, string>("StartTime", data.StartTime.ToString()), 
                    new KeyValuePair<string, string>("EndTime", data.EndTime.ToString()), 
                    new KeyValuePair<string, string>("RecurrenceID", data.RecurrenceID.ToString()), 
                    new KeyValuePair<string, string>("RecurrenceRule", data.RecurrenceRule), 
                    new KeyValuePair<string, string>("RecurrenceException", data.RecurrenceException), 
                    new KeyValuePair<string, string>("IsAllDay", data.IsAllDay.ToString()) 
                }); 
                var json = await client.PutAsync("https://localhost:44382/api/schedule", formContent); 
                records = changedRecords; 
            } 
            return records; 
        } 
    } 
} 


Kindly try the above sample and get back to us if you need any further assistance. 

Regards, 
Ravikumar Venkatesan 



AL Alex September 9, 2020 07:14 AM UTC

Thanks for the further work around but this has become way too complicated, can you confirm when the fix when be released?


VD Vinitha Devi Murugan Syncfusion Team September 10, 2020 09:27 AM UTC

 
Thanks for your update. 
 
As promised earlier the fix for “GetCurrentViewDate always empty is this a known issue?” will be available on our upcoming volume 3 release which is scheduled to be rolled out at the end of September 2020. You can track this defect status in the below feedback link. We appreciate your patience.  
 
Regards, 
Vinitha 



VM Vengatesh Maniraj Syncfusion Team October 7, 2020 09:31 AM UTC

Hi Alex,

 

We are glad to announce that our Essential Studio 2020 Volume 3 release v18.3.0.35  is rolled out. In that release, We have fixed the reported issue. So please update your package to this version to include the fix.

 

NuGet Link: https://www.nuget.org/packages/Syncfusion.Blazor/18.3.0.35

Release notes: https://blazor.syncfusion.com/documentation/release-notes/18.3.35/?type=all#scheduler

 

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

 

Regards,

Vengatesh 


Marked as answer
Loader.
Up arrow icon