Appointments are cleared on batch add/update

Hi,

We are using batch add/edit functionality for the schedule control and it was working fine. But after recent version upgrades whenever a new appointment is added or existing appointment is edited the schedule control clears all existing appointments.

We need to refresh the page to view the updated appointments.

Sample Code:

 public async Task<ActionResult> Batch([FromBody] CalendarModel model)
{
            // Executes while adding an appointment
            if (param.action == "insert" || (param.action == "batch" && param.added != null))
            {
                if (param.action ==  "insert")
                {                
                    //Save to DB
                    _repository.SaveAppointment(model);
                }
                else
                {
                    foreach (var appointment in param.added)
                    {
                      //Save to DB
                    _repository.SaveAppointment(model);
                    }
                }

            //Get Appointments
            var appointments = _repository.GetAppointments().ToList(); //Calls the GET Method that returns all appointments
            }
}

Could you please help us?

Thanks,
Ajay.

4 Replies

AJ Ajay March 18, 2017 05:01 PM UTC

Hi,

Please merge this with this thread. I'm facing the same issue.


Thanks,
Ajay.


KK Karthigeyan Krishnamurthi Syncfusion Team March 20, 2017 08:39 AM UTC

Hi Ajay 
  
Thank you for contacting Syncfusion support.  
  
We suspect that appointment Start/EndTime are not in correct format after performing CRUD operation which could be the cause for the issue. Kindly use the below code example to overcome the reported issue.  
  
<Code>  
<ej-schedule id="Schedule1" width="100%" height="525px" create="onCreate" current-date="new DateTime(2014, 12, 5)">  
    <e-appointment-settings apply-time-offset="false" id="Id" subject='"Subject"' start-time='"StartTime"' end-time='"EndTime"' all-day='"AllDay"' recurrence='"Recurrence"' recurrence-rule='"RecurrenceRule"'>  
        <e-datamanager url="Home/GetData" crud-url="Home/Batch" adaptor="UrlAdaptor"></e-datamanager>  
    </e-appointment-settings>  
</ej-schedule>  
  
<script >  
    function onCreate(args) { // this function will be called during the initial load of the Schedule  
        Date.prototype.parseISO8601 = function (date) {  
            return (typeof (date) === 'string') ? date.indexOf("Date") != -1 ? new Date(parseInt(date.match(/\d+/).toString())) : date.indexOf("T") != -1 ? new Date(date) : new Date(date.replace(/-/g, "/")) : new Date(date);  
        };  
    }  
</script>  
</Code>  
  
Regards,  
Karthigeyan  
 



AJ Ajay March 21, 2017 08:53 PM UTC

Thank you very much. Your fix works perfectly.


KK Karthigeyan Krishnamurthi Syncfusion Team March 22, 2017 04:33 AM UTC

 
We are happy that your issue has been resolved. 
 
Please let us know if you need further assistance. 
 
Regards, 
Karthigeyan 


Loader.
Up arrow icon