php - javascript kendo scheduler with json data moves events only once -
i have kendo scheduler , i'm having problem move event. can move 1 event @ time , can't grab event afterwards. think there's wrong dates can't figure out why. tried datasource
2-3 events , it's working when put exact same data in php , return json. it's not working.
any appreciated.
$("#scheduler").kendoscheduler({ date: new date(), starttime: new date(today2()), timezone: "etc/utc", currenttimemarker: false, height: 800, views: [ "week", { type: "month", selected: true, eventheight: 60} ], datasource: { transport: { read: { url: "tasks.php", datatype: "json" }, batch: true, parametermap: function (options, operation) { if (operation === "read") { var scheduler = $("#scheduler").data("kendoscheduler"); var result = { start: scheduler.view().startdate(), end: scheduler.view().enddate() } return kendo.stringify(result); } return kendo.stringify(options); } }, schema: { model: { id: "taskid", fields: { taskid: { type: "number", from: "tt_code" }, start: { type: "date", from: "tt_start_datetime"}, end: { type: "date", from: "tt_end_datetime"}, title: { from: "tt_edit"} } } } } });
php file json data:
$json[0]['tt_code'] = 1; $json[0]['tt_start_datetime'] = "2016-01-16 15:00:00"; $json[0]['tt_end_datetime']= "2016-01-16 16:00:00"; $json[0]['tt_edit'] = "fast , furious 6"; echo json_encode($json);
since specified start
, end
date in model, scheduler expecting received formatted date. while json passes date string, javascript still expect date string formatted.
in case, be:
$json[0]['tt_code'] = 1; $json[0]['tt_start_datetime'] = "2016-01-16t15:00:00.000z"; $json[0]['tt_end_datetime']= "2016-01-16t16:00:00.000z"; $json[0]['tt_edit'] = "fast , furious 6";
you leave date , handle string custom logic in parametermap
function.
as side note, if have doubt type formatting, go in browser console , have @ network tab. you'll able compare data sent working service data sent php , see difference.
Comments
Post a Comment