Hi guys! I have a problem. When I am in month view and click on an existing event, the create form displays instead of edit. Can you help me please? Thank you. Below is my code of init_scheduler();
function initScheduler() {
dhtmlx.image_path = '<?php echo Yii::app()->baseUrl; ?>/imgs/';
/* Scheduler */
scheduler.config.multi_day = true;
scheduler.config.xml_date = "%Y-%m-%d %H:%i";
scheduler.templates.event_class = function(start, end, event) {
if (start < (new Date())) //if date in past
return "past_event"; //then set special css class for it
}
scheduler.config.drag_create = true;
scheduler.config.event_duration = 60;
scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.cascade_event_display = true; // enable rendering, default value = false
scheduler.config.cascade_event_count = 4; // how many events events will be displayed in cascade style (max), default value = 4
scheduler.config.cascade_event_margin = 20; // margin between events, default value = 30
scheduler.xy.menu_width = 0;
scheduler.config.show_loading = true;
scheduler.config.first_hour = 6;
scheduler.config.last_hour = scheduler.config.first_hour + 24;
scheduler.config.mark_now = true;
scheduler.init('scheduler', null, "week");
scheduler.attachEvent("onViewChange", function (mode , date){
//any custom logic here
$(".dhx_scale_hour").each(function(){
k=greek_hour($(this).html());
$(this).html(k);
});
colorize_tasks();
});
scheduler.attachEvent("onXLE", function (){
colorize_tasks();
});
scheduler.attachEvent("onEventAdded", function (){
colorize_tasks();
});
scheduler.attachEvent("onEventChanged", function (){
colorize_tasks();
});
scheduler.attachEvent("onEventSave", function (){
colorize_tasks();
});
scheduler.load('<?php echo Yii::app()->request->baseUrl; ?>/site/getData');
scheduler.config.dblclick_create;
scheduler.attachEvent("onClick", function(event_id, native_event_object) {
var ev = scheduler.getEvent(event_id);
openLightbox('dialog', '<?php echo Yii::app()->baseUrl; ?>/tasks/update/id/' + event_id, ev.text, 950);
colorize_tasks();
return false;
});
scheduler.attachEvent("onEventChanged", function(event_id, event_object) {
$.ajax({
type: 'GET',
url: '<?php echo Yii::app()->baseUrl; ?>/tasks/updateEventTime/?id=' + event_id + '&snew=' + format(event_object.start_date) + '&enew=' + format(event_object.end_date) + '',
success: function(){
colorize_tasks();
window.top.$("#notifbox").load('<?php echo Yii::app()->request->baseUrl; ?>/site/notifications');
}
});
});
$('#chkbox').live('click', function() {
scheduler.detachAllEvents();
//console.log('Ok!');
return false;
});
scheduler.showLightbox = function(id) {
evopen = scheduler.getEvent(id);
var lurl = null;
if (id > 1000000) {
lurl = '<?php echo Yii::app()->baseUrl; ?>/tasks/create';
} else {
lurl = '<?php echo Yii::app()->baseUrl; ?>/tasks/update/id/' + id;
}
id > 1000000 ? scheduler.deleteEvent(id) : true;
openLightbox('dialog', lurl, 'Νέα Καταχώρηση', 950);
}
}