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
close icon

SfCalendar view not refreshing on month change on Android

I am using a SfCalendar to display availability of a company asset via events placed on the calendar, which I pull from a REST service. On Android, when you change to the next month, the data is being loaded, but it is as if the view is not refreshing. If I click on a date that has an event, it will expand and show the event, but the calendar itself does not have a badge for that day.
However, if you switch to the previous month and then back again, the calendar behaves as expected. This is only on Android, the iOS version is working properly. Is this a known issue, or does anyone have any insight into this?
Thanks!
John K.

8 Replies

TH Toine Holtmann March 6, 2017 08:33 AM UTC

I have the same problems with the BlackoutDates on Android! Also the SelectionChanged event doesn't seem to fire on Android.


RG Richard Grothe March 6, 2017 12:31 PM UTC

Same issue here. Until swipe scheduler i not refreshing changed tasks in weekview.
Thanks!
Richard


RK Rathana Kumar Sekar Syncfusion Team March 6, 2017 12:37 PM UTC

Hi John,

Thank you for contacting Syncfusion Support.

Query : "Issue with events indication in SfCalendar (Android)"


We have analyzed the reported issue in our side with our latest version. But we were unable to reproduce the reported issue. So could you please provide following information about this issue.


1)Device or Emulator (In which we can reproduce the reported issue)

2)API level of the Device

3)Essential Studio Version

4)If possible could you please provide issue reproducing sample


It will help us to provide appropriate solution on this.


Please find the sample in which we have checked the reported issue in our side in below

Sample:https://www.syncfusion.com/downloads/support/forum/129201/ze/DataSourceUpdateIssue-1948120155


Regards,

Rathanakumar S.




RK Rathana Kumar Sekar Syncfusion Team March 6, 2017 12:42 PM UTC

Hi Tonie,

We were able to reproduce the reported issue "Blackout dates not update dynamically" from our side. A support incident to track the status of the issue has been created under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents 


Regards,
Rathanakumar S
 



SP Subburaj Pandian Veluchamy Syncfusion Team March 8, 2017 10:57 AM UTC

Hi Richard,

  

We have created a new support incident under your account to track the status of the SfSchedule related query. Please log on to our support website to check for further updates. 


https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents 


Please let us know, if you have any query.



Regards,

Subburaj Pandian V



JK John Kirksey March 8, 2017 02:30 PM UTC

Rathana,

thanks for taking a look at this. Here is the info on my environment:

1. I have tested this on the built in Android emulator, Genymotion, and on a physical device
2. API 23 (6.0)
3. Syncfusion Essential Studio version 15.1.0.33
4. I'll put a sample in a separate message. The code is somewhat long, so I'll pull out the relevant bits.

Thanks!

John Kirksey


JK John Kirksey March 8, 2017 03:18 PM UTC

Rathana,

Here are the relevant snippets of code. I created a test project just to test loading static, hard-coded events when the month changes, and it works. The problem must be with the asynchronous loading of events when the REST services returns. One option I would have is to perform that synchronously, which in my opinion is not an option. The UI would block until the call was complete. It seems in my asynchronous scenario, the calendar is first loaded into the UI. Then the REST service returns the data and the calendar UI is not refreshed, even though the data has been loaded into the calendar, it is not displayed until you take some action on the calendar. Again, this is working on iOS, so I assume it has something to do with the UI lifecycle on Android. Anyway, here is almost all of the the code from the calendar page: 


namespace Foo
{
    
    public partial class Calendar : ContentPage
    {
 

        private string _flightdata = null;
        private string _holddata = null;
        private string _mxdata = null;
        private string _authdata = "";
        private string _authheader = "";
        private List<string> _loadedMonths = null;

        SfCalendar calendar;
        CalendarEventCollection col = new CalendarEventCollection();
 

        public Calendar()
        {
  

            _loadedMonths = new List<string>();

            calendar = new SfCalendar();
            calendar.ShowInlineEvents = true;
            calendar.ShowNavigationButtons = true;
            calendar.MonthChanged += LoadNewMonth;

            LoadFlights(DateTime.Now);
            _loadedMonths.Add(DateTime.Now.Month.ToString());

            layout.Children.Add(calendar);
  
                     }

        private void LoadFlights(DateTime currDate)
        {
            vm.IsLoading = true;

            string startDate = currDate.Month.ToString() + "/1/" + currDate.Year.ToString();
            string endDate = currDate.Month.ToString() + "/" + DateTime.DaysInMonth(currDate.Year, currDate.Month).ToString() + 
                             "/" + currDate.Year.ToString();

            Task<bool> success = GetData(startDate, endDate);

        }

        private void LoadNewMonth(object sender, MonthChangedEventArgs e)
        {
            DateTime currDate = e.args.CurrentValue;
            DateTime prevDate = e.args.PreviousValue;

            if (!_loadedMonths.Contains(currDate.Month.ToString()))
            {
                _loadedMonths.Add(currDate.Month.ToString());
                LoadFlights(currDate);

            }

            calendar.MoveToDate = e.args.CurrentValue;
        }
 

        public async Task<bool> GetData(string start, string end)
        {
            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _authheader);
            client.MaxResponseContentBufferSize = 512000;
            Uri flightUrl = new Uri(String.Format(Constants.ServiceUrl + "/getflights?start=" + start + "&end=" + end, string.Empty));

            try
            {
                HttpContent responseContent;
                var response = await client.GetAsync(flightUrl);
                if (response.IsSuccessStatusCode)
                {
                    responseContent = response.Content;
                    _flightdata = responseContent.ReadAsStringAsync().Result;
                    var flightobj = JsonConvert.DeserializeObject<List<Flight>>(_flightdata);
                    foreach (Flight f in flightobj)
                    {
                        CalendarInlineEvent ev = new CalendarInlineEvent();
                        ev.Subject = f.ORIGIN + "-" + f.DEST;
                        ev.StartTime = Convert.ToDateTime(f.LOCALLEAVE);
                        ev.EndTime = Convert.ToDateTime(f.LOCALARRIVE);
                        ev.Color = Color.FromHex("68A0ED");
                        col.Add(ev);
                    }
                }
  
                calendar.DataSource = col;
                calendar.MoveToDate = Convert.ToDateTime(start);
                vm.IsLoading = false;
                return true;
            }
            catch (Exception e)
            {
                Page p = new Page();

                await p.DisplayAlert("ERROR!", e.ToString(), "Close");
                return false;
            }
  


RK Rathana Kumar Sekar Syncfusion Team March 9, 2017 12:03 PM UTC

Hi John,

Thanks for your update.

We were unable to reproduce the reported issue from side. A support incident  has been created under your account.  Please log on to our support website to check for further updates.

Regards,
Rathanakumar S.


Loader.
Live Chat Icon For mobile
Up arrow icon