Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial documentation of source using Markdown

  • Loading branch information...
commit 4511a5ea8a6a5eece4b715c60252b1ed35574a5d 1 parent 766c3eb
@ltvolks ltvolks authored
Showing with 213 additions and 122 deletions.
  1. +213 −122 js/jquery.fn.gantt.js
View
335 js/jquery.fn.gantt.js
@@ -1,6 +1,27 @@
+// jQuery Gantt Chart
+// ==================
+
+// Basic usage:
+
+// $(".selector").gantt({
+// source: "ajax/data.json",
+// scale: "weeks",
+// minScale: "weeks",
+// maxScale: "months",
+// onItemClick: function(data) {
+// alert("Item clicked - show some details");
+// },
+// onAddClick: function(dt, rowId) {
+// alert("Empty space clicked - add an item!");
+// },
+// onRender: function() {
+// console.log("chart rendered");
+// }
+// });
+
+//
/*jshint shadow:true, unused:false, laxbreak:true, evil:true*/
/*globals jQuery, alert*/
-
(function ($) {
"use strict";
@@ -9,7 +30,7 @@
var cookieKey = "jquery.fn.gantt";
var scales = ["hours", "days", "weeks", "months"];
-
+ //Default settings
var settings = {
source: null,
itemsPerPage: 7,
@@ -28,6 +49,11 @@
scrollToToday: true
};
+ // custom selector `:findday` used to match on specified day in ms.
+ //
+ // The selector is passed a date in ms and elements are added to the
+ // selection filter if the element date matches, as determined by the
+ // id attribute containing a parsable date in ms.
$.extend($.expr[":"], {
findday: function (a, i, m) {
var cd = new Date(parseInt(m[3], 10));
@@ -40,7 +66,7 @@
return cd.getTime() === ed.getTime();
}
});
-
+ // custom selector `:findweek` used to match on specified week in ms.
$.extend($.expr[":"], {
findweek: function (a, i, m) {
var cd = new Date(parseInt(m[3], 10));
@@ -52,7 +78,7 @@
return cd === ed;
}
});
-
+ // custom selector `:findmonth` used to match on specified month in ms.
$.extend($.expr[":"], {
findmonth: function (a, i, m) {
var cd = new Date(parseInt(m[3], 10));
@@ -65,6 +91,12 @@
}
});
+ // Date prototype helpers
+ // ======================
+
+ // `getWeekId` returns a string in the form of 'dh-YYYY-WW', where WW is
+ // the week # for the year.
+ // It is used to add an id to the week divs
Date.prototype.getWeekId = function () {
var y = this.getFullYear();
var w = this.getDayForWeek().getWeekOfYear();
@@ -75,8 +107,8 @@
return 'dh-' + y + "-" + w;
};
-
-
+ // `getRepDate` returns the seconds since the epoch for a given date
+ // depending on the active scale
Date.prototype.genRepDate = function () {
switch (settings.scale) {
case "hours":
@@ -89,11 +121,15 @@
return this.getTime();
}
};
+
+ // `getDayOfYear` returns the day number for the year
Date.prototype.getDayOfYear = function () {
var fd = new Date(this.getFullYear(), 0, 0);
var sd = new Date(this.getFullYear(), this.getMonth(), this.getDate());
return Math.ceil((sd - fd) / 86400000);
};
+
+ // `getWeekOfYear` returns the week number for the year
Date.prototype.getWeekOfYear = function () {
var ys = new Date(this.getFullYear(), 0, 1);
var sd = new Date(this.getFullYear(), this.getMonth(), this.getDate());
@@ -104,9 +140,14 @@
return Math.ceil(daysCount / 7);
};
+
+ // `getDaysInMonth` returns the number of days in a month
Date.prototype.getDaysInMonth = function () {
return 32 - new Date(this.getFullYear(), this.getMonth(), 32).getDate();
};
+
+ // `hasWeek` returns `true` if the date resides on a week boundary
+ // **????????????????? Don't know if this is true**
Date.prototype.hasWeek = function () {
var df = new Date(this.valueOf());
df.setDate(df.getDate() - df.getDay());
@@ -119,6 +160,9 @@
return (df.getMonth() === this.getMonth() && dt.getDate() < 4) || (df.getMonth() !== this.getMonth() && dt.getDate() >= 4);
}
};
+
+ // `getDayForWeek` returns the Date object for the starting date of
+ // the week # for the year
Date.prototype.getDayForWeek = function () {
var df = new Date(this.valueOf());
df.setDate(df.getDate() - df.getDay());
@@ -131,11 +175,14 @@
}
};
- /**
- * Core functions for creating grid.
- */
- var core = {
+ // Grid management
+ // ===============
+
+ // Core object is responsible for navigation and rendering
+ var core = {
+ // Return the element whose topmost point lies under the given point
+ // Normalizes for IE
elementFromPoint: function (x, y) {
if ($.browser.msie) {
@@ -148,13 +195,12 @@
return document.elementFromPoint(x, y);
},
- /**
- * Create header
- */
+
+ // **Create the chart**
create: function (element) {
- /**
- * Retrieve data
- */
+
+ // Initialize data with a json object or fetch via an xhr
+ // request depending on `settings.source`
if (typeof settings.source !== "string") {
element.data = settings.source;
core.init(element);
@@ -165,6 +211,10 @@
});
}
},
+
+ // **Setup the initial view**
+ // Here we calculate the number of rows, pages and visible start
+ // and end dates once the data is ready
init: function (element) {
element.rowsNum = element.data.length;
element.pageCount = Math.ceil(element.rowsNum / settings.itemsPerPage);
@@ -174,9 +224,11 @@
element.dateEnd = tools.getMaxDate(element);
- // core.render(element);
+ /* core.render(element); */
core.waitToggle(element, true, function () { core.render(element); });
},
+
+ // **Render the grid**
render: function (element) {
var content = $('<div class="fn-content"/>');
var $leftPanel = core.leftPanel(element);
@@ -201,6 +253,7 @@
core.markNow(element);
core.fillData(element, $dataPanel, $leftPanel);
+ // Set a cookie to record current position in the view
if (settings.useCookie) {
var sc = $.cookie(this.cookieKey + "ScrollPos");
if (sc) {
@@ -208,6 +261,7 @@
}
}
+ // Scroll the grid to today's date
if (settings.scrollToToday) {
var startPos = Math.round((settings.startPos / 1000 - element.dateStart / 1000) / 86400) - 2;
if ((startPos > 0 && element.hPosition !== 0)) {
@@ -227,6 +281,7 @@
} else {
core.repositionLabel(element);
}
+ // or, scroll the grid to the left most date in the panel
} else {
if ((element.hPosition !== 0)) {
if (element.scaleOldWidth) {
@@ -251,6 +306,8 @@
core.waitToggle(element, false);
settings.onRender();
},
+
+ // Create and return the left panel with labels
leftPanel: function (element) {
/* Left panel */
var ganttLeftPanel = $('<div class="leftPanel"/>')
@@ -276,21 +333,21 @@
ganttLeftPanel.append(entries.join(""));
return ganttLeftPanel;
},
+
+ // Create and return the data panel element
dataPanel: function (element, width) {
var dataPanel = $('<div class="dataPanel" style="width: ' + width + 'px;"/>');
- /*
- * Mouse wheel events
- */
- var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel";
+ // Handle mousewheel events for scrolling the data panel
+ var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel";
if (document.attachEvent) {
element.attachEvent("on" + mousewheelevt, function (e) { core.wheelScroll(element, e); });
} else if (document.addEventListener) {
element.addEventListener(mousewheelevt, function (e) { core.wheelScroll(element, e); }, false);
}
-
- // addNEwClick
+ // Handle click events and dispatch to registered `onAddClick`
+ // function
dataPanel.click(function (e) {
e.stopPropagation();
@@ -315,12 +372,13 @@
break;
}
- // Adjust, so get middle of elm
- // corrY -= Math.floor(tools.getCellSize() / 2);
+ /* Adjust, so get middle of elm
+ corrY -= Math.floor(tools.getCellSize() / 2);
+ */
- //find column
+ // Find column where click occurred
var col = core.elementFromPoint(e.pageX, datapanel.offset().top + corrY);
- // hit the label?
+ // Was the label clicked directly?
if (col.className === "fn-label") {
col = $(col.parentNode);
} else {
@@ -328,9 +386,9 @@
}
var dt = col.attr("repdate");
- //find row
+ // Find row where click occurred
var row = core.elementFromPoint(leftpanel.offset().left + leftpanel.width() - 10, e.pageY);
- // hit the label?
+ // Was the lable clicked directly?
if (row.className.indexOf("fn-label") === 0) {
row = $(row.parentNode);
} else {
@@ -338,14 +396,20 @@
}
var rowId = row.data().id;
+ // Dispatch user registered function with the DateTime in ms
+ // and the id if the clicked object is a row
settings.onAddClick(dt, rowId);
});
return dataPanel;
},
- // Creates Data container with header
+
+ // Creates and return the right panel containing the year/week/day
+ // header
rightPanel: function (element, leftPanel) {
var range = null;
+ // Days of the week have a class of one of
+ // `sn` (Saturday), `sa` (Sunday), or `wd` (Weekday)
var dowClass = [" sn", " wd", " wd", " wd", " wd", " wd", " sa"];
var gridDowClass = [" sn", "", "", "", "", "", " sa"];
@@ -368,8 +432,9 @@
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
var holidays = settings.holidays ? settings.holidays.join() : '';
+ // Setup the headings based on the chosen `settings.scale`
switch (settings.scale) {
- // hours /////////////////////////////////////////////////////////////////////////////////////////
+ // **Hours**
case "hours":
range = tools.parseTimeRange(element.dateStart, element.dateEnd, element.scaleStep);
@@ -380,9 +445,8 @@
for (var i = 0; i < range.length; i++) {
var rday = range[i];
- /*
- * Fill years
- */
+
+ // Fill years
var rfy = rday.getFullYear();
if (rfy !== year) {
yearArr.push(
@@ -397,9 +461,8 @@
}
daysInYear++;
- /*
- * Fill months
- */
+
+ // Fill months
var rm = rday.getMonth();
if (rm !== month) {
monthArr.push(
@@ -413,9 +476,9 @@
}
daysInMonth++;
- /*
- * Fill days & hours
- */
+
+ // Fill days & hours
+
var rgetDay = rday.getDay();
var getDay = day.getDay();
var day_class = dowClass[rgetDay];
@@ -448,18 +511,15 @@
+ '</div>');
}
- /*
- * Last year
- */
- yearArr.push(
+ // Last year
+ yearArr.push(
'<div class="row header year" style="width: '
+ tools.getCellSize() * daysInYear + 'px;"><div class="fn-label">'
+ year
+ '</div></div>');
- /*
- * Last month
- */
+
+ // Last month
monthArr.push(
'<div class="row header month" style="width: '
+ tools.getCellSize() * daysInMonth + 'px"><div class="fn-label">'
@@ -482,10 +542,8 @@
var dataPanel = core.dataPanel(element, range.length * tools.getCellSize());
- /*
- * Append panel elements
- */
+ // Append panel elements
dataPanel.append(yearArr.join(""));
dataPanel.append(monthArr.join(""));
dataPanel.append($('<div class="row"/>').html(dayArr.join("")));
@@ -494,7 +552,7 @@
break;
- // weeks /////////////////////////////////////////////////////////////////////////////////////////
+ // **Weeks**
case "weeks":
range = tools.parseWeeksRange(element.dateStart, element.dateEnd);
yearArr = ['<div class="row"/>'];
@@ -505,9 +563,8 @@
for (var i = 0; i < range.length; i++) {
var rday = range[i];
- /*
- * Fill years
- */
+
+ // Fill years
if (rday.getFullYear() !== year) {
yearArr.push(
('<div class="row header year" style="width: '
@@ -520,9 +577,7 @@
}
daysInYear++;
- /*
- * Fill months
- */
+ // Fill months
if (rday.getMonth() !== month) {
monthArr.push(
('<div class="row header month" style="width:'
@@ -534,25 +589,22 @@
daysInMonth = 0;
}
daysInMonth++;
- /*
- * Fill weeks
- */
+
+ // Fill weeks
dayArr.push('<div class="row day wd" '
+ ' id="' + rday.getWeekId() + '" offset="' + i * tools.getCellSize() + '" repdate="' + rday.genRepDate() + '"> '
+ ' <div class="fn-label">' + rday.getWeekOfYear() + '</div></div>');
}
- /*
- * Last year
- */
+
+ // Last year
yearArr.push(
'<div class="row header year" style="width: '
+ tools.getCellSize() * daysInYear + 'px;"><div class="fn-label">'
+ year
+ '</div></div>');
- /*
- * Last month
- */
+
+ // Last month
monthArr.push(
'<div class="row header month" style="width: '
+ tools.getCellSize() * daysInMonth + 'px"><div class="fn-label">'
@@ -561,13 +613,11 @@
var dataPanel = core.dataPanel(element, range.length * tools.getCellSize());
-
dataPanel.append(yearArr.join("") + monthArr.join("") + dayArr.join("") + (dowArr.join("")));
-
-
break;
- // months ////////////////////////////////////////////////////////////////////////////////////////
+
+ // **Months**
case 'months':
range = tools.parseMonthsRange(element.dateStart, element.dateEnd);
@@ -577,9 +627,8 @@
for (var i = 0; i < range.length; i++) {
var rday = range[i];
- /*
- * Fill years
- */
+
+ // Fill years
if (rday.getFullYear() !== year) {
yearArr.push(
('<div class="row header year" style="width: '
@@ -592,22 +641,17 @@
}
daysInYear++;
monthArr.push('<div class="row day wd" id="dh-' + tools.genId(rday.getTime()) + '" offset="' + i * tools.getCellSize() + '" repdate="' + rday.genRepDate() + '">' + (1 + rday.getMonth()) + '</div>');
-
-
-
}
- /*
- * Last year
- */
+
+ // Last year
yearArr.push(
'<div class="row header year" style="width: '
+ tools.getCellSize() * daysInYear + 'px;"><div class="fn-label">'
+ year
+ '</div></div>');
- /*
- * Last month
- */
+
+ // Last month
monthArr.push(
'<div class="row header month" style="width: '
+ tools.getCellSize() * daysInMonth + 'px">"<div class="fn-label">'
@@ -616,17 +660,15 @@
var dataPanel = core.dataPanel(element, range.length * tools.getCellSize());
- /*
- * Append panel elements
- */
+ // Append panel elements
dataPanel.append(yearArr.join(""));
dataPanel.append(monthArr.join(""));
dataPanel.append($('<div class="row"/>').html(dayArr.join("")));
dataPanel.append($('<div class="row"/>').html(dowArr.join("")));
-
break;
- // days //////////////////////////////////////////////////////////////////////////////////////////
+
+ // **Days (default)**
default:
range = tools.parseDateRange(element.dateStart, element.dateEnd);
@@ -636,9 +678,8 @@
for (var i = 0; i < range.length; i++) {
var rday = range[i];
- /*
- * Fill years
- */
+
+ // Fill years
if (rday.getFullYear() !== year) {
yearArr.push(
('<div class="row header year" style="width:'
@@ -651,9 +692,8 @@
}
daysInYear++;
- /*
- * Fill months
- */
+
+ // Fill months
if (rday.getMonth() !== month) {
monthArr.push(
('<div class="row header month" style="width:'
@@ -680,17 +720,15 @@
+ ' <div class="fn-label">' + settings.dow[getDay] + '</div></div>');
} //for
- /*
- * Last year
- */
+
+ // Last year
yearArr.push(
'<div class="row header year" style="width: '
+ tools.getCellSize() * daysInYear + 'px;"><div class="fn-label">'
+ year
+ '</div></div>');
- /*
- * Last month
- */
+
+ // Last month
monthArr.push(
'<div class="row header month" style="width: '
+ tools.getCellSize() * daysInMonth + 'px"><div class="fn-label">'
@@ -699,9 +737,9 @@
var dataPanel = core.dataPanel(element, range.length * tools.getCellSize());
- /*
- * Append panel elements
- */
+
+ // Append panel elements
+
dataPanel.append(yearArr.join(""));
dataPanel.append(monthArr.join(""));
dataPanel.append($('<div class="row"/>').html(dayArr.join("")));
@@ -713,9 +751,11 @@
return $('<div class="rightPanel"></div>').append(dataPanel);
},
-
+ // **Navigation**
navigation: function (element) {
var ganttNavigate = null;
+ // Scrolling navigation is provided by setting
+ // `settings.navigate='scroll'`
if (settings.navigate === "scroll") {
ganttNavigate = $('<div class="navigate" />')
.append($('<div class="nav-slider" />')
@@ -824,8 +864,8 @@
$(document).mouseup(function () {
element.scrollNavigation.scrollerMouseDown = false;
});
+ // Button navigation is provided by setting `settings.navigation='buttons'`
} else {
- /* Navigation panel */
ganttNavigate = $('<div class="navigate" />')
.append($('<span role="button" class="nav-link nav-page-back"/>')
.html('&lt;')
@@ -888,6 +928,10 @@
}
return $('<div class="bottom"/>').append(ganttNavigate);
},
+
+ // **Progress Bar**
+ // Return an element representing a progress of position within
+ // the entire chart
createProgressBar: function (days, cls, desc, label, dataObj) {
var cellWidth = tools.getCellSize();
var barMarg = tools.getProgressBarMargin() || 0;
@@ -921,6 +965,9 @@
});
return bar;
},
+
+ // Remove the `wd` (weekday) class and add `today` class to the
+ // current day/week/month (depending on the current scale)
markNow: function (element) {
switch (settings.scale) {
case "weeks":
@@ -939,6 +986,8 @@
}
},
+ // **Fill the Chart**
+ // Parse the data and fill the data panel
fillData: function (element, datapanel, leftpanel) {
var invertColor = function (colStr) {
try {
@@ -953,15 +1002,16 @@
return "";
}
};
+ // Loop through the values of each data element and set a row
$.each(element.data, function (i, entry) {
if (i >= element.pageNum * settings.itemsPerPage && i < (element.pageNum * settings.itemsPerPage + settings.itemsPerPage)) {
$.each(entry.values, function (j, day) {
var _bar = null;
+
switch (settings.scale) {
+ // **Hourly data**
case "hours":
-
-
var dFrom = tools.genId(tools.dateDeserialize(day.from).getTime(), element.scaleStep);
var from = $(element).find('#dh-' + dFrom);
@@ -988,6 +1038,8 @@
datapanel.append(_bar);
break;
+
+ // **Weekly data**
case "weeks":
var dtFrom = tools.dateDeserialize(day.from);
var dtTo = tools.dateDeserialize(day.to);
@@ -1029,8 +1081,9 @@
datapanel.append(_bar);
break;
- case "months":
+ // **Monthly data**
+ case "months":
var dtFrom = tools.dateDeserialize(day.from);
var dtTo = tools.dateDeserialize(day.to);
@@ -1069,7 +1122,7 @@
datapanel.append(_bar);
break;
- // Days
+ // **Days**
default:
var dFrom = tools.genId(tools.dateDeserialize(day.from).getTime());
var dTo = tools.genId(tools.dateDeserialize(day.to).getTime());
@@ -1108,7 +1161,7 @@
}
});
},
-
+ // **Navigation**
navigateTo: function (element, val) {
var $rightPanel = $(element).find(".fn-gantt .rightPanel");
var $dataPanel = $rightPanel.find(".dataPanel");
@@ -1162,10 +1215,9 @@
element.scrollNavigation.panelMargin = val;
break;
}
-
-
-
},
+
+ // Navigate to a specific page
navigatePage: function (element, val) {
if ((element.pageNum + val) >= 0 && (element.pageNum + val) < Math.ceil(element.rowsNum / settings.itemsPerPage)) {
core.waitToggle(element, true, function () {
@@ -1176,6 +1228,8 @@
});
}
},
+
+ // Change zoom level
zoomInOut: function (element, val) {
core.waitToggle(element, true, function () {
@@ -1232,6 +1286,8 @@
core.init(element);
});
},
+
+ // Move chart via mouseclick
mouseScroll: function (element, e) {
var $dataPanel = $(element).find(".fn-gantt .dataPanel");
$dataPanel.css("cursor", "move");
@@ -1245,6 +1301,8 @@
clearTimeout(element.scrollNavigation.repositionDelay);
element.scrollNavigation.repositionDelay = setTimeout(core.repositionLabel, 50, element);
},
+
+ // Move chart via mousewheel
wheelScroll: function (element, e) {
var delta = e.detail ? e.detail * (-50) : e.wheelDelta / 120 * 50;
@@ -1259,6 +1317,8 @@
return false;
}
},
+
+ // Move chart via slider control
sliderScroll: function (element, e) {
var $sliderBar = $(element).find(".nav-slider-bar");
var $sliderBarBtn = $sliderBar.find(".nav-slider-button");
@@ -1293,6 +1353,8 @@
element.scrollNavigation.repositionDelay = setTimeout(core.repositionLabel, 5, element);
}
},
+
+ // Update scroll panel margins
scrollPanel: function (element, delta) {
if (!element.scrollNavigation.canScroll) {
return false;
@@ -1310,6 +1372,8 @@
}
core.synchronizeScroller(element);
},
+
+ // Synchronize scroller
synchronizeScroller: function (element) {
if (settings.navigate === "scroll") {
var $rightPanel = $(element).find(".fn-gantt .rightPanel");
@@ -1330,6 +1394,8 @@
$sliderBtn.css("left", pos * -1);
}
},
+
+ // Reposition data labels
repositionLabel: function (element) {
setTimeout(function () {
var $dataPanel;
@@ -1345,6 +1411,8 @@
}
}, 500);
},
+
+ // waitToggle
waitToggle: function (element, show, fn) {
if (show) {
var eo = $(element).offset();
@@ -1367,11 +1435,11 @@
}
};
- /**
- * Additional functions
- */
+ // Utility functions
+ // =================
var tools = {
+ // Return the maximum available date in data depending on the scale
getMaxDate: function (element) {
var maxDate = null;
$.each(element.data, function (i, entry) {
@@ -1403,6 +1471,8 @@
}
return maxDate;
},
+
+ // Return the minimum available date in data depending on the scale
getMinDate: function (element) {
var minDate = null;
$.each(element.data, function (i, entry) {
@@ -1433,6 +1503,8 @@
}
return minDate;
},
+
+ // Return an array of Date objects between `from` and `to`
parseDateRange: function (from, to) {
var current = new Date(from.getTime());
var end = new Date(to.getTime());
@@ -1445,6 +1517,9 @@
return ret;
},
+
+ // Return an array of Date objects between `from` and `to`,
+ // scaled hourly
parseTimeRange: function (from, to, scaleStep) {
var current = new Date(from);
var end = new Date(to);
@@ -1463,6 +1538,9 @@
} while (current.getTime() <= to.getTime());
return ret;
},
+
+ // Return an array of Date objects between a range of weeks
+ // between `from` and `to`
parseWeeksRange: function (from, to) {
var current = new Date(from);
@@ -1471,7 +1549,6 @@
var ret = [];
var i = 0;
do {
-
if (current.getDay() === 0) {
ret[i++] = current.getDayForWeek();
}
@@ -1480,6 +1557,10 @@
return ret;
},
+
+
+ // Return an array of Date objects between a range of months
+ // between `from` and `to`
parseMonthsRange: function (from, to) {
var current = new Date(from);
@@ -1494,14 +1575,15 @@
return ret;
},
+
+ // Deserialize a date from a string
dateDeserialize: function (dateStr) {
//return eval("new" + dateStr.replace(/\//g, " "));
var date = eval("new" + dateStr.replace(/\//g, " "));
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes());
},
-
-
+ // Generate an id for a date
genId: function (ticks) {
var t = new Date(ticks);
switch (settings.scale) {
@@ -1525,6 +1607,8 @@
return (new Date(t.getFullYear(), t.getMonth(), t.getDate())).getTime();
}
},
+
+ // Get the current cell size
_getCellSize: null,
getCellSize: function () {
if (!tools._getCellSize) {
@@ -1536,6 +1620,8 @@
}
return tools._getCellSize;
},
+
+ // Get the current size of the rigth panel
getRightPanelSize: function () {
$("body").append(
$('<div style="display: none; position: absolute;" class="fn-gantt" id="measureCellWidth"><div class="rightPanel"></div></div>')
@@ -1544,9 +1630,13 @@
$("#measureCellWidth").empty().remove();
return ret;
},
+
+ // Get the current page height
getPageHeight: function (element) {
return element.pageNum + 1 === element.pageCount ? element.rowsOnLastPage * tools.getCellSize() : settings.itemsPerPage * tools.getCellSize();
},
+
+ // Get the current margin size of the progress bar
_getProgressBarMargin: null,
getProgressBarMargin: function () {
if (!tools._getProgressBarMargin) {
@@ -1561,8 +1651,8 @@
}
};
- this.each(function () {
+ this.each(function () {
/**
* Extend options with default values
*/
@@ -1570,11 +1660,11 @@
$.extend(settings, options);
}
- this.data = null; // Recived data
+ this.data = null; // Received data
this.pageNum = 0; // Current page number
- this.pageCount = 0; // Aviable pages count
+ this.pageCount = 0; // Available pages count
this.rowsOnLastPage = 0; // How many rows on last page
- this.rowsNum = 0; //
+ this.rowsNum = 0; // Number of total rows
this.hPosition = 0; // Current position on diagram (Horizontal)
this.dateStart = null;
this.dateEnd = null;
@@ -1582,6 +1672,7 @@
this.scaleOldWidth = null;
this.headerRows = null;
+ // Update cookie with current scale
if (settings.useCookie) {
var sc = $.cookie(this.cookieKey + "CurrentScale");
if (sc) {
Please sign in to comment.
Something went wrong with that request. Please try again.