| Autor | Zpráva | ||
|---|---|---|---|
| Jan Žák Profil |
#1 · Zasláno: 6. 8. 2015, 20:10:39
Dobr den všem,
rád bych Vás požádal o radu. Pomocí scriptu Fullcalendar jsem si udělal plánovací kalendář, přes ajax vkládám data do db. Vše funguje v pořádku. Při zakládání nového eventu se otevře prompt okno. Rád bych toto změnil na modal okno z bootstrapu, na který teď web předělávám. Mohl by jste mi někdo poradit jak toto udělat? Děkuji. $(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#tweeve-calendar').fullCalendar({
editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
// load events from db
events: "calendar-load.php",
// convert the allDay from string to boolean
eventRender: function(event, element, view) {
if (event.allDay === 'true') {
event.allDay = true;
} else {
event.allDay = false;
}
},
// insert event
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
var title = prompt('Název události:');
if (title) {
var start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: 'events-ajax-add.php',
data: 'title='+title+'&start='+ start +'&end='+ end ,
type: "POST",
success: function(json) {
alert('Úspěšně vloženo');
}
});
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
// drop event
editable: true,
eventDrop: function(event, delta) {
var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: 'events-ajax-edit.php',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json) {
alert("Úspěšně aktualizováno");
}
});
},
// resize event
eventResize: function(event) {
var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: 'events-ajax-edit.php',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json) {
alert("Úspěšně aktualizováno");
}
});
}
});
}); |
||
| _es Profil |
#2 · Zasláno: 6. 8. 2015, 20:55:30
V 32. riadku si zmeň získanie hodnoty do premennej
title inak ako cez promp. Ako presne, ti neporadím, keďže ani neviem, čo to „modal okno z bootstrapu“ vlastne je. Ale asi to má nejakú dokumentáciu, tak to skús pozrieť tam.
|
||
|
Časová prodleva: 4 dny
|
|||
| Jan Žák Profil |
#3 · Zasláno: 10. 8. 2015, 17:12:19
_es:
To jsem zkoušel, ale bohužel bez výsledku, tím modal dialogem jsem myslel toto: http://jsfiddle.net/mccannf/azmjv/16/ bohužel se mi nedaří skloubit můj kód, s tímto příkladem a uložit do db |
||
|
Časová prodleva: 11 let
|
|||
0