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.
Unfortunately, activation email could not send to your email. Please try again.

SfCalendar view not refreshing on month change on Android

Thread ID:

Created:

Updated:

Platform:

Replies:

129201 Mar 3,2017 04:01 PM Mar 9,2017 07:03 AM Xamarin.Forms 8
loading
Tags: SfCalendar
John Kirksey
Asked On March 3, 2017 04:01 PM

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.

Toine Holtmann
Replied On March 6, 2017 03:33 AM

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

Richard Grothe
Replied On March 6, 2017 07:31 AM

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

Rathana Kumar Sekar [Syncfusion]
Replied On March 6, 2017 07:37 AM

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: http://www.syncfusion.com/downloads/support/forum/129201/ze/DataSourceUpdateIssue-1948120155 


 Regards, 

Rathanakumar S. 

Rathana Kumar Sekar [Syncfusion]
Replied On March 6, 2017 07:42 AM

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
 


Subburaj Pandian Veluchamy [Syncfusion]
Replied On March 8, 2017 05:57 AM

 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
 

John Kirksey
Replied On March 8, 2017 09:30 AM

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

John Kirksey
Replied On March 8, 2017 10:18 AM

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;
            }
  

Rathana Kumar Sekar [Syncfusion]
Replied On March 9, 2017 07:03 AM

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.

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

Regards,
Rathanakumar S.


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.

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.

;