I am trying to attach an onClick event listener to events whilst in timeline mode for the scheduler. It works as long as I don’t use a dataprocessor, so without the last 3 lines in the code, it pops up hello when I click on an event.
It also works when displaying it in the month view rather than timeline view. When in timelineview however, clicking on the event just fires off a dataprocessor update request and the onclick action is never fired.
I may be missing something very obvious but I can’t see what.
In the example below, connector.php is returning valid data (it’s displaying fine anyway) and dp.php is just a dummy here which always returns succesful
[code]scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.locale.labels.timeline_tab =“Timeline”;
scheduler.config.start_on_monday = true;
scheduler.config.timeout_to_display = 50;
scheduler.config.delta_x = 15;
scheduler.config.delta_y = -20;
var format=scheduler.date.date_to_str("%Y-%m-%d %H:%i");
scheduler.createTimelineView({
name:"timeline",
x_unit:"day",//measuring unit of the X-Axis.
x_date:"%j %F", //date format of the X-Axis
x_step:1, //X-Axis step in 'x_unit's
x_size:7, //X-Axis length specified as the total number of 'x_step's
x_start:0, //X-Axis offset in 'x_unit's
x_length:1, //number of 'x_step's that will be scrolled at a time
y_property:"employeeid", //mapped data property
y_unit:[
{key:'1', label:'James'}
],
render:"bar" //view mode
});
scheduler.attachEvent("onClick", function(id){
alert("Hello");
return true;
});
scheduler.load("connector.php", "json");
scheduler.init('scheduler_here', new Date(),"timeline");
var dp = new dataProcessor("dp.php");
dp.enableDebug(true);
dp.init(scheduler);[/code]