Scroll to event time on select event via javascript


I decided to implement a event searcher (ajax search, filterable) in a seperate window.
When i select a searched item, scheduler jumps to the day of the event anbd selects it. Perhaps i will implement a highlighting while selected, but for the moment it is not that important.

For better undertsanding here’s my called function:

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

I commented the lines not working yet, but my idea is to search the first “:” and than save the hour of the event by adding the two chars in front of that “:”. The scrollTop-Fucntion works great, just not getting the correct event hour (temp).

The error is totally strange: It tells me (via firefox extension), that indexOf is not a funciton… also when i use other js functions… strange? Ok, i puttet these function above the init-code and than… he says “split” is not a function… CXause this is used in dhtmlscheduler…

I thing i am losed,cause i can’t get the error… I thing it has nothing to do with scheduler?

So wanna ask for easier way to get the hour out of this events? :slight_smile:))

Temporarily the function works like a sharm without scrolling :slight_smile:

Best wishes,

scheduler already contains a lot of date formatting code, which can be reused

function goto_event(id) { var goto_temp = scheduler.getEventStartDate(id); var hour ="%G"); var temp = hour(goto_temp);

that indexOf is not a funciton
Actually it is corret, goto_temp is Date object, not a string, so you can use


Sounds perfect…
It seems like i forgot to convert Type… See, coming from PHP :wink:

Thanks a lot… I test it tomorrow, but of course this will work great!

After the steps, temp equals “%G”, not just the hour :-/
What could be wrong?

It works correctly locally, maybe you have a typo in config line, or you are using a really old version of scheduler , which doesn’t support %G option.