| Issue 669: | Events from DB | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Hi!
I'm using your calendar for my website but I need to add events from database so I already have the code that brings me the events I want to show on the calendar but when I try to add them to it
shows 2 calendars, one with the default events and another empty.. please help me!!
<script type='text/javascript'>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
header: {
left: '',
center: 'title',
right: ''
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
editable: true,
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
}
]
});
});
alert(events[0]);
function CargarActividades()
{
var parametros = document.getElementById("ctl00_ContentPlaceHolder1_txt_semana").value;
Servidor(parametros);
}
function mostrarActividades(Resultado) {
var param = getActividades(Resultado);
var calendar = $('#calendar').fullCalendar({
events: [param]
});
alert("hola");
alert(events);
}
function getActividades(Resultado) {
var actividad = Resultado.toString().split('.');
for(var i=0;i<actividad.length-1;i++) {
var act_campos = actividad[i].toString().split('-');
var id = act_campos[0].toString();
var descripcion = act_campos[1].toString();
var fecha = act_campos[2].toString().split('/');
var stringdate = fecha[1] + "/" + fecha[0] + "/" + fecha[2];
var fechaInicio = new Date(stringdate);
var horaInicio = act_campos[3].toString();
var hI = horaInicio.split(':');
fechaInicio.setHours(parseInt(hI[0]), hI[1], hI[2]);
var fechaFin = new Date(stringdate);
var horaFin = act_campos[4].toString();
var hF = horaFin.split(':');
fechaFin.setHours(parseInt(hF[0]), hF[1], hF[2]);
var param = "{title: '" + descripcion + "',start: "+fechaInicio+",end: "+fechaFin+"}," + param;
}
var param = param + "{title: '" + descripcion + "',start: " + fechaInicio + ",end: " + fechaFin + "}";
return param;
}
</script>
Nov 21, 2010
Project Member
#1
adamrs...@gmail.com
Status:
Done
|
|
| ► Sign in to add a comment |