bugfixing and streamlining related to issue 235 enhancement

This commit is contained in:
Adam Shaw 2010-09-27 19:37:11 -07:00
parent f1251cd0ba
commit 82aacbb9d8
2 changed files with 111 additions and 19 deletions

View file

@ -256,21 +256,12 @@ function AgendaView(element, calendar, viewName) {
viewHeight = height;
slotTopCache = {};
body.height(height - head.height());
var bodyHeight = height - head.height();
bodyHeight = Math.min(bodyHeight, bodyTable.height()); // shrink to fit table
body.height(bodyHeight);
slotHeight = body.find('tr:first div').height() + 1;
bg.css({
top: head.find('tr').height(),
height: height
});
// if the table ends up shorter than the allotted view, shrink the view to fit the table
var tableHeight = body.find('table:first').height();
if (tableHeight < body.height()) {
body.height(tableHeight);
}
if (dateChanged) {
resetScroll();
}
@ -282,26 +273,28 @@ function AgendaView(element, calendar, viewName) {
viewWidth = width;
colContentPositions.clear();
body.width(width);
body.width(width).css('overflow', 'auto');
bodyTable.width('');
var topTDs = head.find('tr:first th'),
allDayLastTH = head.find('tr.fc-all-day th:last'),
stripeTDs = bg.find('td'),
clientWidth = body[0].clientWidth;
bodyTable.width(clientWidth);
clientWidth = body[0].clientWidth; // in ie6, sometimes previous clientWidth was wrongly reported
bodyTable.width(clientWidth);
// time-axis width
axisWidth = 0;
setOuterWidth(
head.find('tr:lt(2) th:first').add(body.find('tr:first th'))
.width('')
.width(1)
.each(function() {
axisWidth = Math.max(axisWidth, $(this).outerWidth());
}),
axisWidth
);
axisWidth = axisWidth;
// column width, except for last column
colWidth = Math.floor((clientWidth - axisWidth) / colCnt);
@ -309,17 +302,22 @@ function AgendaView(element, calendar, viewName) {
setOuterWidth(topTDs.slice(1, -2), colWidth);
// column width for last column
var hasScrollbar = body[0].scrollHeight != body[0].clientHeight;
if (hasScrollbar) {
if (width != clientWidth) { // has scrollbar
setOuterWidth(topTDs.slice(-2, -1), clientWidth - axisWidth - colWidth*(colCnt-1));
topTDs.slice(-1).show();
allDayLastTH.show();
}else{
body.css('overflow', 'hidden');
topTDs.slice(-2, -1).width('');
topTDs.slice(-1).hide();
$('tr.fc-all-day th').slice(-1).hide();
allDayLastTH.hide();
}
bg.css({
top: head.find('tr').height(),
left: axisWidth,
width: clientWidth - axisWidth
width: clientWidth - axisWidth,
height: viewHeight
});
}

94
tests/short_agenda.html Normal file
View file

@ -0,0 +1,94 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type='text/javascript' src='../src/_loader.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
},
defaultView: 'agendaWeek',
allDaySlot: false,
slotMinutes: 60,
editable: true,
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 5),
end: new Date(y, m, d, 14, 43),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
]
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 13px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 70%;
margin: 0 auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>