Source code of the tutorial is available for download.
Client side (JavaScript)
dp.onTaskMove = function(args) { var params = { id: args.task.id(), start: args.newStart.toString(), end: args.newEnd.toString() }; $.ajax({ type: 'POST', url: '/api/tasks/move', data: JSON.stringify(params), success: function (data) { dp.message("Task moved"); }, contentType: "application/json", dataType: 'json' }); };
Server side (Spring)
package org.daypilot.demo.html5ganttchartspring.controller; // ... @RestController @RequestMapping("/api/tasks") public class TaskController { @Autowired TaskRepository tr; @PostMapping("/move") @JsonSerialize(using = LocalDateTimeSerializer.class) @Transactional Task moveTask(@RequestBody EventMoveParams params) { Task e = tr.findOne(params.id); e.setStart(params.start); e.setEnd(params.end); tr.save(e); return e; } // ... public static class EventMoveParams { public Long id; public LocalDateTime start; public LocalDateTime end; } }