Problem with scheduler and liveupdate


#1

Hello,

My liveupdate with node.js it’s working normally when i add or move an event in the scheduler but when i use

scheduler.addEventNow({
start_date: new Date(),
end_date: new Date(),
text: select_filleul,
filleuls_id_filleuls: select_id_filleul
});

i have this error:

Uncaught TypeError: Cannot call method ‘valueOf’ of undefined (dhtmlxscheduler.js:150)

excuse for my english language.

Thanks


#2

Please provide a full stack trace ( can be checked in js console ) or a demo link where issue can be checked, as from above message - it is not clear why the issue occurs.

Also, you are providing end_date similar to start_date which is invalid date range ( you can just skip end_date in case of addEventNow - it will use default event length to calculate it )


#3

re,

Nota: all is working before liveupdate and the problem is the same when i doubleclick
After error, it’s impossible to add or update an event i have to reload the page.

the trace:

Uncaught TypeError: Cannot call method ‘valueOf’ of undefined dhtmlxscheduler.js:150
scheduler.addEvent dhtmlxscheduler.js:150
scheduler.add live_updates.js:204
(anonymous function) live_updates.js:33
dataProcessor.ignore dhtmlx.js:389
(anonymous function) live_updates.js:32
(anonymous function) sync.js:1
Faye.extend.each sync.js:1
Faye.Publisher.publishEvent sync.js:1
(anonymous function) sync.js:1
Faye.extend.each sync.js:1
Faye.extend.Set.Faye.Class.distributeMessage sync.js:1
Faye.Client.Faye.Class._A sync.js:1
(anonymous function) sync.js:1
Faye.Extensible.pipeThroughExtensions sync.js:1
Faye.Client.Faye.Class.receiveMessage sync.js:1
Faye.extend.each sync.js:1
Faye.Transport.Faye.extend.Faye.Class.receive sync.js:1
_b.onmessage sync.js:1

the scheduler configuration:

[i]scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.show_loading = true;
scheduler.config.full_day = true;
scheduler.config.dblclick_create = false;

scheduler.config.update_render = false;
scheduler.config.first_hour = 09;
scheduler.config.last_hour = 18;
scheduler.config.event_duration = 30; 
scheduler.config.auto_end_date = true;
scheduler.config.limit_time_select = true;
scheduler.config.time_step = 30;
scheduler.config.collision_limit = 1;
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.icons_select = ['icon_delete'];
scheduler.config.icons_edit = ['icon_cancel'];
scheduler.config.readonly_form = false;
scheduler.config.scroll_hour = new Date().getHours();
scheduler.locale.labels.section_Club = "CLUB";
scheduler.locale.labels.section_NomParrain = "PARRAIN";
scheduler.locale.labels.section_Filleul = "ID FILLEUL";
scheduler.locale.labels.section_description = "FILLEUL";
scheduler.locale.labels.section_Statut = 'STATUT RDV (definit par le club)';

scheduler.form_blocks.textarea.set_value=function(node,value,ev){
node.firstChild.value=value||"";
node.firstChild.disabled = true; //or just '= true' to disable all events
}


var statuts = [
{ key: 1, label: 'ABANDON' },
{ key: 2, label: 'VISITEUR' },
{ key: 3, label: 'VENDU' }

];
scheduler.config.lightbox.sections = [
{name:“description”, height:100, map_to:“text”, type:“textarea”, focus:true},
{name:“Club”, height:43, type:“select”, map_to:“clubs_id_club”, options: scheduler.serverList(“club”)},
{name:“Filleul”, height:30, type:“textarea”, map_to:“filleuls_id_filleuls”},
{name:“Statut”, height:58, options:statuts, map_to:“etat_rdv”, type:“radio”},
{name:“time”, height:72, type:“time”, map_to:“auto”}
];
scheduler.templates.tooltip_text = function(start,end,event) {
var statut = “AUCUN STATUT”;

if (event.etat_rdv == 1) {
var statut = "ABANDON";
}
if (event.etat_rdv == 2) {
var statut = "VISITEUR";
}
if (event.etat_rdv == 3) {
var statut = "VENDU";
}

return "<b>STATUT CLUB:</b> "+statut;
};
cell_agenda.attachScheduler();


var dpsched = new dataProcessor("xml/scheduler.php");
dpsched.live_updates("http://localhost:8008/sync");
dpsched.setTransactionMode("POST",true); // because i have connector
dpsched.init(scheduler);[/i]

Thanks


#4

Sorry but it still not clear, what is the reason of the problem - the above code looks fine.


#5

re,

it seems to be a problem Date: ev.start_date and ev.end_date in scheduler.addEvent according dhtmlxscheduler.js: 3184 is undefined when the liveupdate is active:

the test:
if (ev.start_date.valueOf () == ev.end_date.valueOf ()) -> fails

nota: it’s ok when i move events not when i create

thanks.


#6

Updated live_update.js is attached , it must resolve the issue.
live_updates.zip (1.78 KB)


#7

This seems still to be a problem,
I’ve installed the latest version and the same happens with me.
I can move the tasks but cant create new without getting that same error