| Issue 375: | Fullcalendar: Patch for double click support | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Hi, First of all: Thanks for this great Calendar plugin for jquery. It's awesome! I've added double click support for the day and slot regions. I have attached a patch against the latest download version (1.4.5). For that i have copied the default dayClick handler and attached a .dblclick() on every element where a .click() is attached. Only drawback: You can only use the single click *OR* the double click handler, since the singleClick handler (and not the doubleClick handler) is invoked even on a double click if both are defined. Johann
Mar 15, 2010
Project Member
#1
adamrs...@gmail.com
Status:
Done
Jul 3, 2014
hi johann, I see the code where i need to add this --- media/scripts/fullcalendar/fullcalendar.js (revision 10) +++ media/scripts/fullcalendar/fullcalendar.js (working copy) @@ -1102,6 +1102,8 @@ s += "</tr>"; } tbody = $(s + "</tbody>").appendTo(table); + // JS, 2010-03-03 + tbody.find('td').dblclick(dayDoubleClick); tbody.find('td').click(dayClick); segmentContainer = $("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(element); @@ -1135,6 +1137,8 @@ } tbody.append(s); } + // JS, 2010-03-03 + tbody.find('td.fc-new').removeClass('fc-new').click(dayDoubleClick); tbody.find('td.fc-new').removeClass('fc-new').click(dayClick); // re-label and re-class existing cells @@ -1203,7 +1207,14 @@ view.trigger('dayClick', this, date, true, ev); } - + function dayDoubleClick(ev) { + var n = parseInt(this.className.match(/fc\-day(\d+)/)[1]), + date = addDays( + cloneDate(view.visStart), + Math.floor(n/colCnt) * 7 + n % colCnt + ); + view.trigger('dayDoubleClick', this, date, true, ev); + } function setHeight(height) { viewHeight = height; @@ -1732,6 +1743,8 @@ } s+= "</table></div>"; head = $(s).appendTo(element); + // JS, 2010-03-03 + head.find('td').dblclick(slotDoubleClick); head.find('td').click(slotClick); // all-day event container @@ -1757,6 +1770,8 @@ .append(bodyContent = $("<div style='position:relative;overflow:hidden'>") .append(bodyTable = $(s))) .appendTo(element); + // JS, 2010-03-03 + body.find('td').dblclick(slotDoubleClick); body.find('td').click(slotClick); // slot event container @@ -1907,6 +1922,21 @@ } } + function slotDoubleClick(ev) { + var col = Math.floor((ev.pageX - bg.offset().left) / colWidth), + date = addDays(cloneDate(view.visStart), dit + dis*col), + rowMatch = this.className.match(/fc-slot(\d+)/); + if (rowMatch) { + var mins = parseInt(rowMatch[1]) * options.slotMinutes, + hours = Math.floor(mins/60); + date.setHours(hours); + date.setMinutes(mins%60 + minMinute); + view.trigger('dayDoubleClick', this, date, false, ev); + }else{ + view.trigger('dayDoubleClick', this, date, true, ev); + } + } + |
|
| ► Sign in to add a comment |