My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1956: The 'agendaWeek' or 'agendaDay' views can not trigger 'dayRender'
  Back to list
Status:  Duplicate
Merged:  issue 1898
Owner:  adamrs...@gmail.com
Closed:  Aug 2013


Sign in to add a comment
 
Project Member Reported by adamrs...@gmail.com, Aug 10, 2013
Enter a detailed description
 I want render context menu on the 'agendaWeek' cell, but i find this callback can only support 'basicWeek' and 'basicDay' views.
So, i thought of a temporary solution.In 'agendaWeek' each cell on the floating div, then bind the 'dayRender' trigger.
Remark:Code modifications on fullCalendar v1.6.2

    function setWidth(width) {
		viewWidth = width;
		colPositions.clear();
		colContentPositions.clear();

		var axisFirstCells = dayHead.find('th:first');
		if (allDayTable) {
			axisFirstCells = axisFirstCells.add(allDayTable.find('th:first'));
		}
		axisFirstCells = axisFirstCells.add(slotTable.find('th:first'));
		
		axisWidth = 0;
		setOuterWidth(
			axisFirstCells
				.width('')
				.each(function(i, _cell) {
					axisWidth = Math.max(axisWidth, $(_cell).outerWidth());
				}),
			axisWidth
		);
		
		var gutterCells = dayTable.find('.fc-agenda-gutter');
		if (allDayTable) {
			gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter'));
		}

		var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7)
		
		gutterWidth = slotScroller.width() - slotTableWidth;
		if (gutterWidth) {
			setOuterWidth(gutterCells, gutterWidth);
			gutterCells
				.show()
				.prev()
				.removeClass('fc-last');
		}else{
			gutterCells
				.hide()
				.prev()
				.addClass('fc-last');
		}
		
		colWidth = Math.floor((slotTableWidth - axisWidth) / colCnt);
		setOuterWidth(dayHeadCells.slice(0, -1), colWidth);

        if(viewName == 'agendaWeek' || viewName == 'agendaDay'){
            dayRenderByAgendaWeek();
        }
	}

    function dayRenderByAgendaWeek() {
        $("table.fc-agenda-slots td").each(function (i, _row) {
            var $div = $(_row).find("div:first");
            $div.html("");
            for (var col_index = 0; col_index < colCnt; col_index++) {
                var s = "<div style='float:left;width:" + colWidth + "px'></div>";
                var cell = $(s).appendTo($div);
                var date = cellToDate(0, col_index);
                var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/);
                if (rowMatch) {
                    var mins = parseInt(rowMatch[1]) * opt('slotMinutes');
                    var hours = Math.floor(mins / 60);
                    date.setHours(hours);
                    date.setMinutes(mins % 60 + minMinute);
                    trigger('dayRender', t, date, cell);
                }
            }
        });
    }
Aug 10, 2013
Project Member #1 adamrs...@gmail.com
originally entered on the github issue tracker: https://github.com/arshaw/fullcalendar/issues/116

by mygu: https://github.com/mygu
Aug 24, 2013
Project Member #2 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Duplicate
Mergedinto: 1898
Sign in to add a comment

Powered by Google Project Hosting