goTo specifix Date/Time

Hello again!

I gotta good progress on my project to find out free time slots via website.
Will share the code to the community, if anybody is interrested…

But before i am frustrating in jumping to a speciffic Date, or a speciffic time within a date in scheduler.

The task is to klick on a textlink (in a seperatet dialog over the scheduler) and than scheduler should setCurrentView to the clicked date (and time).
I have a method to jump to a specific event, this is for searching an existing event, click on it in the reuslt and scheduler set the view to the specified EXISTING event…

In this case i need to jump to the timeslot, that is free… So i have no event_id to give to the function…

I can only share the information “24.02.2011 08:15” for example…

Perhaps you can give me a clue, how to change my existing function?

function goto_event(id) { var goto_temp = scheduler.getEventStartDate(id); var temp_pos = goto_temp.toString().indexOf(":"); var temp = goto_temp.toString().charAt(temp_pos-2)+""+goto_temp.toString().charAt(temp_pos-1); // alert(temp); // Thu Oct 07 2010 09:00:00 GMT+0200 scheduler.setCurrentView(goto_temp,"day"); scheduler.select(id); scheduler._els["dhx_cal_data"][0].scrollTop = (temp - scheduler.config.first_hour) * scheduler.config.hour_size_px; }

Best wishes,
BennY from Germany :slight_smile:

By using scheduler.date.str_to_date you can convert your date string to date object and use it inside the setCurrentView. Scrolling to the necessary hour can be done through simple math

[code]var target = “24.02.2011 08:15”;
var fdate = scheduler.date.str_to_date("%d.%m.%Y %H:%i");

var dateobj = fdate(target);
scheduler.setCurrentView(dateobj,“day”);
var pos = dateobj.getHours()1+dateobj.getMinutes()/60;
scheduler._els[“dhx_cal_data”][0].scrollTop = (pos
-scheduler.config.first_hour) * scheduler.config.hour_size_px;
[/code]

Perhaps i just have to construct a correct date-format to use this:

scheduler.setCurrentView(XYZ,"day"); ?

Oh, this was same time… Okay, so i was rigth with setCurrentView :9
Will try it immediatly… Thank YOU!

Hello,

Also note that probably you can simplify your goto_event function:

function goto_event(id) { var start_date = scheduler.getEvent(id).start_date; var pos = start_date.getHours()*1+start_date.getMinutes()/60; scheduler.setCurrentView(start_date,"day"); scheduler.select(id); scheduler._els["dhx_cal_data"][0].scrollTop = (pos-scheduler.config.first_hour) * scheduler.config.hour_size_px; }
Best regards,
Ilya

Okay, i will try it also :slight_smile:
Thanks a lot again…

Just for complete this Topic for other users looking for such a function:

In Ilyas-Posting there is one “*” to much, so change it to the following:

scheduler._els["dhx_cal_data"][0].scrollTop = (pos-scheduler.config.first_hour) * scheduler.config.hour_size_px;

Hi,
I open this discussions again because i use the 2Fast4UeXtrem function. I want a link that open map view and select the event by the id.
I use the function and script switch correctly to map view, but dont’ select my event.
where is the problem? the id is ok (testing by alert)…

[code]
function goto_event(id) {
var goto_temp = scheduler.getEventStartDate(id);
var temp_pos = goto_temp.toString().indexOf(":");
var temp = goto_temp.toString().charAt(temp_pos-2)+""+goto_temp.toString().charAt(temp_pos-1);
scheduler.setCurrentView(goto_temp,“map”);
scheduler.select(id);

 }[/code]

the link (write by js) document.getElementById("reportMAP").innerHTML = '<a href="#" onclick="goto_event('+event_id+');" title="mappa">Mappa</a>';

thanks!
Fra