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.

Dates from PHP

Thread ID:

Created:

Updated:

Platform:

Replies:

124879 Jul 6,2016 12:59 AM Jul 20,2016 02:28 AM JavaScript 7
loading
Tags: ejSchedule
David Barrett
Asked On July 6, 2016 12:59 AM



Im passing in data for events in ejSchedule from a PHP backend web service and it doesn't seem to like the way Im passing in the start and end dates. In all your examples your handing it a javascript Date object so I am not sure how to hand them in through php. 

I have tried a date string, a epoch time number, and some other ways and nothing seems to work. How should I hand the dates in through the JSON made in php

Thanks

Uma Maheswari C [Syncfusion]
Replied On July 8, 2016 03:25 PM

Hi David, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared the Scheduler sample depicting the way to connect it with PHP backend service and also the date conversion that needs to be handled for the StartTime and endTime fields at the client-side which are returned as JSON from the server, before it is being assigned to the Scheduler dataSource. This date conversion needs to be carried out within the Create event of the Scheduler. Please refer the runnable sample from the below downloadable location –  
 
Please create the required database and the tables with required fields. Here, we have used the database named demo. 
 
Note: The downloaded files needs to be loaded into the server before running it. 
 
Kindly refer the sample and let us know if you require any further assistance on this. 
 
Regards, 
C. Uma Maheswari 


David Barrett
Replied On July 9, 2016 10:36 PM



 Thank you very much that helped me figure out the dates thing. One thing though is this way passes no information as to where they are in the calendar (load on demand) so that I don't have to pass all the schedule information which is upwards of 30000 records to date and just growing, and with 60-70 resources I am not able to load all data at once as the page will crash or be so slow its unusable. 

Is there a change I can make to the ej.Query call that will allow me to piecemeal records quickly? Or do I need to put a different function in the change of view call as well as the create function?

Thanks

Mahesh Palanisamy [Syncfusion]
Replied On July 11, 2016 12:55 PM

  
Hi David,    
    
Thanks for the update. 
    
By default, Scheduler supports Load data on demand concept. Kindly refer to the following links to know more about the concept and hot it works from here -   
 
For other data manager querying (ej.Query()) options, kindly refer here - http://help.syncfusion.com/js/datamanager/query     
 
Kindly check the above link and let us know, if you need any further assistance on this. 
    
Regards,    
Mahesh 


David Barrett
Replied On July 11, 2016 01:38 PM



Thanks for the reply,

    I understand how the load on demand feature works when using your direct connectors, my question was more based on the answer you gave me above to get my php information into the calendar. With the method above, the "create" function call that goes and gets the schedule information, hands the back-end no data to tell me what data to load-on-demand, since I am not using the standard connectors. The standard connectors hand the back-end the current date, the view, and other things. The function you showed me hands an empty call with no request data. I was wondering how I use that function you sent me with the features that allow for load-on demand. 

Also I am using plain straight javascript (jquery) and php/mysql (no angular, azure, oData connectors or anything/systems like this)

Thanks

Mahesh Palanisamy [Syncfusion]
Replied On July 19, 2016 11:49 AM

Hi David, 

Thanks for your patience. 

We have prepared the workaround sample to meet  your requirement with load on demand concept along with the option to handle the back-end data [current date, current view and other things] which can be downloaded from the below location: 
  
In client-side, we have raised the “create” and “actionComplete” event to get the required data from database and also to process the date conversion problem. In these events, we can also pass additional parameters to the server-side. 

The following code has been used in the above sample - 

<Code> 
     function getData(args) { 
        if (args.type == "create" || args.type == "actionComplete") { 
            var dataManger = ej.DataManager({ url: "Data.php" }); 
            dataManger.adaptor = new ej.UrlAdaptor(); 
            var query = new ej.Query(); 
            //Here pass the required parameters to filter data 
            query.addParams("CurrentDate", new Date(new Date(this.currentDate()).setHours(0, 0, 0))).addParams("CurrentView", this.currentView()).addParams("CurrentAction", args.type); 
            var queryPromise = dataManger.executeQuery(query); 
            queryPromise.done(function (e) { 
                var appointments = [], data = e.result; 
                for (var i = 0; i < data.length; i++) { 
                    appointments.push({ Id: parseInt(data[i]["Id"]), Subject: data[i]["Subject"], AllDay: parseInt(data[i]["AllDay"]), StartTime: new Date(data[i]["StartTime"]), EndTime: new Date(data[i]["EndTime"]), Recurrence: parseInt(data[i]["Recurrence"]), RecurrenceRule: data[i]["RecurrenceRule"] }); 
                } 
                $("#Schedule1").ejSchedule({ appointmentSettings: { dataSource: appointments } }); 
            }); 
        } 
    } 
<Code> 

Kindly check the above sample and let us know, if you need any further assistance on this. 

Regards, 
Mahesh  


David Barrett
Replied On July 19, 2016 12:29 PM



Thanks for the reply, that gives me all the information I need. Thanks!

Karthigeyan Krishnamurthi [Syncfusion]
Replied On July 20, 2016 02:28 AM

Hi David,   
   
We are happy to hear that our previous solution worked as per your requirement. Kindly, let us know if you need any further assistance.   
   
Regards,   
Karthigeyan   
 


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.

;