customd / jquery-calendar

A full day, week, and resource calendar for use with jQuery.
MIT License
62 stars 26 forks source link

Question: Date and Time of New Event on "click" #23

Closed infopete closed 10 years ago

infopete commented 10 years ago

Hi

I've seen this: $('#calendar').on('click','.ui-cal-time',function(e){ console.log( $(this).attr('time') ) });

And it does give the time on a click event.

However, in the Resource Calendar, can I get the date, time and the Resource Id/name from a "click" event?

samatcd commented 10 years ago

You can use something like this:

$('#calendar').on('click','.ui-cal-time',function(e){
    console.log( 'Time: ', $(this).attr('time') );
    console.log( 'Date: ', $(this).closest('.ui-cal-resource').attr('date') );
    console.log( 'Resource: ', $(this).closest('.ui-cal-resource').attr('resource') );
});
infopete commented 10 years ago

Hi Sam,

getting the time value works all the time but I get "undefined" for the date and resource on last displayed resource.

i.e. I have 5 resource columns Meeting Room 1....to Meeting Room 5 and I get the data for meeting Rooms 1 to 4 but not Meeting Room 5.

Any ideas?

Pete