I use the full jQuery calendar with Spring MVC.
Hello, I made a demo, for example which .
Purpose: I need it, when the user clicks on an event that he has already inserted, a dialog box appears and gives him the opportunity to delete this event or cancel it.
Problem: now, when the user clicks on any day, a dialog box appears allowing the user to enter a title for this event, then the user clicks “Ok” to save this event.
Freemarker: Freemarker:
<script type="text/javascript">
var resourceVacation;
function censor(censor) {
return (function() {
var i = 0;
return function(key, value) {
if (i !== 0 && typeof(censor) === 'object' && typeof(value) == 'object' && censor == value)
return '[Circular]';
++i;
return value;
}
})(censor);
}
function doAjax() {
$.each(resourceVacation, function(index) {
var tmpDate = resourceVacation[index].start;
tmpDate.setHours(tmpDate.getHours() - tmpDate.getTimezoneOffset() / 60);
resourceVacation[index].start=tmpDate;
});
var test = JSON.stringify(resourceVacation, censor(resourceVacation));
var x = test;
$.ajax(
{
url:"[@spring.url '/vacation/saveResourceVacation'/]",
type: "POST",
data :x ,
dataType: "json",
contentType: "application/json"
});
}
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$.getJSON('[@spring.url '/vacation/loadResourceVacation'/]', function (data) {
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true,
select:
function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
start.setHours(start.getHours() - start.getTimezoneOffset() / 60);
var newVacation= {id:133,title:'title',start:start,url: 'title'};
resourceVacation.push(newVacation);
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true
);
}
calendar.fullCalendar('unselect');
},
eventClick: function(calEvent, jsEvent, view) {
alert('Event: ' + calEvent.title);
alert('start: ' + calEvent.start);
}
editable: true,
events:data
});
resourceVacation = data;
});
});
</script>
Controller:
@RequestMapping(value = "/vacation/loadResourceVacation", method = RequestMethod.GET)
public
@ResponseBody
String loadResourceVacation(HttpServletResponse response) throws Exception {
List<VacationFormBean> vacationFormBeanList= buildVacationFormBean();
String json = new Gson().toJson(vacationFormBeanList);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
return json;
}
@RequestMapping(value = "/vacation/saveResourceVacation", method = RequestMethod.POST)
public
@ResponseBody
void saveResourceVacation(@RequestBody String jsonString, Principal principal) throws Exception {
List<String> resourceVacations = extractVacationDatesFromJsonObject(jsonString);
}
VacationFormBean:
public class VacationFormBean {
int id;
String title;
String start;
String url;
}
I need something like this:

======================= UPDATE ======================== =
click domi27.
, freemarker.
java script, : http://arshaw.com/fullcalendar/docs/event_data/removeEvents/
JS:
$('#calendar').fullCalendar('removeEvents', 1);
, .
, , , .
" " , "undefined".
freemarker, , , .
var newVacation = {id:'133',title:'title',start:start,url: 'title'};
resourceVacation.push(newVacation);
script, , , , , .
, , :

, , :
