diff --git a/dist/subtotal.js b/dist/subtotal.js
index 5cc2b2d..3a173f0 100644
--- a/dist/subtotal.js
+++ b/dist/subtotal.js
@@ -94,7 +94,7 @@
})($.pivotUtilities.PivotData);
$.pivotUtilities.SubtotalPivotData = SubtotalPivotData;
SubtotalRenderer = function(pivotData, opts) {
- var addClass, allTotal, arrowCollapsed, arrowExpanded, buildColHeaderHeader, buildColHeaderHeaders, buildColHeaderHeadersClickEvents, buildColHeaders, buildColTotals, buildColTotalsHeader, buildGrandTotal, buildRowHeaderHeaders, buildRowHeaderHeadersClickEvents, buildRowHeaders, buildRowTotalsHeader, buildValues, classColCollapsed, classColExpanded, classColHide, classColShow, classCollapsed, classExpanded, classRowCollapsed, classRowExpanded, classRowHide, classRowShow, clickStatusCollapsed, clickStatusExpanded, colArrowOnInit, colAttrs, colClassOnInit, colClickStatusOnInit, colDisableAfter, colKeys, colTotals, collapseCol, collapseColsAt, collapseHideDescendantRow, collapseRow, collapseRowsAt, collapseShowColSubtotal, collapseShowRowSubtotal, colsCollapseAt, createElement, defaults, expandChildCol, expandChildRow, expandCol, expandColsAt, expandHideColSubtotal, expandHideRowSubtotal, expandRow, expandRowsAt, expandShowColSubtotal, expandShowRowSubtotal, getTableEventHandlers, hasClass, hideDescendantCol, isColDisable, isColDisableExpandCollapse, isColHideOnExpand, isRowDisable, isRowDisableExpandCollapse, isRowHideOnExpand, main, processKeys, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, removeClass, replaceClass, rowAttrs, rowDisableAfter, rowKeys, rowTotals, rowsCollapseAt, setAttributes, setColInitParams, showChildCol, showChildRow, toggleCol, toggleColHeaderHeader, toggleRow, toggleRowHeaderHeader, tree;
+ var addClass, allTotal, arrowCollapsed, arrowExpanded, buildColHeaderHeader, buildColHeaderHeaders, buildColHeaderHeadersClickEvents, buildColHeaders, buildColTotals, buildColTotalsHeader, buildGrandTotal, buildRowHeaderHeaders, buildRowHeaderHeadersClickEvents, buildRowHeaders, buildRowTotalsHeader, buildValues, classColCollapsed, classColExpanded, classColHide, classColShow, classCollapsed, classExpanded, classRowCollapsed, classRowExpanded, classRowHide, classRowShow, clickStatusCollapsed, clickStatusExpanded, colArrowOnInit, colAttrs, colClassOnInit, colClickStatusOnInit, colDisableAfter, colKeys, colTotals, collapseCol, collapseColsAt, collapseHideDescendantRow, collapseRow, collapseRowsAt, collapseShowColSubtotal, collapseShowRowSubtotal, colsCollapseAt, createElement, defaults, expandChildCol, expandChildRow, expandCol, expandColsAt, expandHideColSubtotal, expandHideRowSubtotal, expandRow, expandRowsAt, expandShowColSubtotal, expandShowRowSubtotal, getTableEventHandlers, hasClass, hideDescendantCol, isColDisable, isColDisableExpandCollapse, isColHideOnExpand, isRowDisable, isRowDisableExpandCollapse, isRowHideOnExpand, main, processKeys, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, removeClass, replaceClass, rowArrowOnInit, rowAttrs, rowClassOnInit, rowClickStatusOnInit, rowDisableAfter, rowKeys, rowTotals, rowsCollapseAt, setAttributes, setColInitParams, setRowInitParams, showChildCol, showChildRow, toggleCol, toggleColHeaderHeader, toggleRow, toggleRowHeaderHeader, tree;
defaults = {
table: {
clickCallback: null
@@ -139,6 +139,9 @@
colArrowOnInit = arrowExpanded;
colClassOnInit = classColExpanded;
colClickStatusOnInit = clickStatusExpanded;
+ rowArrowOnInit = arrowExpanded;
+ rowClassOnInit = classRowExpanded;
+ rowClickStatusOnInit = clickStatusExpanded;
hasClass = function(element, className) {
var regExp;
regExp = new RegExp("(?:^|\\s)" + className + "(?!\\S)", "g");
@@ -462,7 +465,7 @@
"data-colnode": colHeader.node
});
addClass(sTh, isColDisable || colHeader.col > colDisableAfter || (isColHideOnExpand && colHeader.col < colsCollapseAt) ? " " + classColHide : " " + classColShow);
- if (isColDisable || colHeader.col > colDisableAfter || colHeader.col !== colsCollapseAt) {
+ if (isColDisable || colHeader.col > colDisableAfter || colHeader.col > colsCollapseAt) {
sTh.style.display = "none";
}
colHeader.children[0].tr.appendChild(sTh);
@@ -476,6 +479,16 @@
colHeader.tr = tr;
return colHeaderCols.push(colHeader);
};
+ setRowInitParams = function(col) {
+ rowArrowOnInit = arrowExpanded;
+ rowClassOnInit = classRowExpanded;
+ rowClickStatusOnInit = clickStatusExpanded;
+ if (col >= rowsCollapseAt && !(isRowDisable || col > rowDisableAfter)) {
+ rowArrowOnInit = arrowCollapsed;
+ rowClassOnInit = classRowCollapsed;
+ return rowClickStatusOnInit = clickStatusCollapsed;
+ }
+ };
buildRowHeaderHeaders = function(thead, rowHeaderHeaders, rowAttrs, colAttrs) {
var className, i, rowAttr, textContent, th, tr;
tr = createElement("tr");
@@ -537,9 +550,19 @@
return tr.appendChild(th);
};
buildRowHeaders = function(tbody, rowHeaderHeaders, rowHeaderRows, rowHeader, rowAttrs, colAttrs) {
- var colspan, h, hh, isRowSubtotal, k, len, ref8, results, style, th, tr;
+ var ch, colspan, h, hh, isRowSubtotal, k, l, len, len1, ref8, ref9, rowspan, style, th, tr;
+ ref8 = rowHeader.children;
+ for (k = 0, len = ref8.length; k < len; k++) {
+ h = ref8[k];
+ buildRowHeaders(tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs);
+ }
+ setRowInitParams(rowHeader.col);
+ isRowSubtotal = rowHeader.children.length !== 0;
+ rowHeader.node = rowHeaderRows.length;
hh = rowHeaderHeaders.hh[rowHeader.col];
- ++hh.expandedCount;
+ if (rowHeader.col <= rowsCollapseAt) {
+ ++hh.expandedCount;
+ }
++hh.nHeaders;
tr = createElement("tr", "pvtRowSubtotal row" + rowHeader.row, "", {
"data-rownode": rowHeader.node
@@ -547,56 +570,80 @@
th = rowHeader.th;
isRowSubtotal = rowHeader.children.length !== 0;
addClass(th, "row" + rowHeader.row + " rowcol" + rowHeader.col + " " + classRowShow);
+ rowspan = 1;
+ if (isRowDisable || rowHeader.col > rowDisableAfter) {
+ rowspan = rowHeader.leaves;
+ } else if (isRowSubtotal && rowHeader.col < rowsCollapseAt) {
+ rowspan = 0;
+ ref9 = rowHeader.children;
+ for (l = 0, len1 = ref9.length; l < len1; l++) {
+ ch = ref9[l];
+ rowspan += parseInt(ch.th.getAttribute("rowspan"));
+ }
+ if (!isRowHideOnExpand) {
+ rowspan += 2;
+ }
+ }
setAttributes(th, {
- "data-rowHeader": th.textContent,
+ "rowspan": rowspan,
+ "colspan": rowHeader.col === rowAttrs.length - 1 && colAttrs.length !== 0 ? 2 : 1,
"data-rownode": rowHeader.node,
- "rowspan": rowHeader.descendants + 1,
- "colspan": rowHeader.col === rowAttrs.length - 1 && colAttrs.length !== 0 ? 2 : 1
+ "data-rowHeader": th.textContent
});
+ if (rowHeader.col > rowsCollapseAt) {
+ th.style.display = "none";
+ }
tr.appendChild(th);
if (isRowSubtotal) {
- addClass(tr, classRowExpanded);
- addClass(th, classRowExpanded);
- if (!(isRowDisableExpandCollapse || isRowDisable || rowHeader.col > rowDisableAfter)) {
- th.textContent = " " + arrowExpanded + " " + th.textContent;
+ tbody.insertBefore(tr, rowHeader.children[0].tr);
+ } else {
+ tbody.appendChild(tr);
+ }
+ rowHeader.tr = tr;
+ if (isRowSubtotal) {
+ addClass(th, rowClassOnInit);
+ addClass(tr, rowClassOnInit);
+ if (!(isRowDisable || rowHeader.col > rowDisableAfter || isRowDisableExpandCollapse)) {
+ th.textContent = " " + rowArrowOnInit + " " + th.textContent;
}
th.onclick = function(event) {
event = event || window.event;
return toggleRow(rowHeaderHeaders, rowHeaderRows, parseInt(event.target.getAttribute("data-rownode")));
};
+ if (isRowDisable || rowHeader.col > rowDisableAfter || rowHeader.col > rowsCollapseAt) {
+ th.style.display = "none";
+ }
colspan = rowAttrs.length - (rowHeader.col + 1) + (colAttrs.length !== 0 ? 1 : 0);
- style = "pvtRowLabel pvtRowSubtotal " + classRowExpanded;
+ style = "pvtRowLabel pvtRowSubtotal " + rowClassOnInit;
style += " row" + rowHeader.row + " rowcol" + rowHeader.col;
- style += isRowHideOnExpand || isRowDisable || rowHeader.col > rowDisableAfter ? " " + classRowHide : " " + classRowShow;
th = createElement("th", style, '', {
"colspan": colspan,
"data-rownode": rowHeader.node
});
- if (isRowHideOnExpand || isRowDisable || rowHeader.col > rowDisableAfter) {
- th.style.display = "none";
- }
+ addClass(th, isRowDisable || rowHeader.col > rowDisableAfter || (isRowHideOnExpand && rowHeader.col < rowsCollapseAt) ? " " + classRowHide : " " + classRowShow);
+ th.style.display = "none";
tr.appendChild(th);
+ tr = createElement("tr", "pvtRowSubtotal row" + rowHeader.row, "", {
+ "data-rownode": rowHeader.node
+ });
+ th = th.cloneNode();
+ th.style.display = isRowDisable || rowHeader.col > rowDisableAfter || (isRowHideOnExpand && rowHeader.col < rowsCollapseAt) ? "none" : "";
+ tr.appendChild(th);
+ tbody.appendChild(tr);
+ rowHeader.sTr = tr;
}
- rowHeader.clickStatus = clickStatusExpanded;
- rowHeader.tr = tr;
- rowHeaderRows.push(rowHeader);
- tbody.appendChild(tr);
- ref8 = rowHeader.children;
- results = [];
- for (k = 0, len = ref8.length; k < len; k++) {
- h = ref8[k];
- results.push(buildRowHeaders(tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs));
- }
- return results;
+ rowHeader.clickStatus = rowClickStatusOnInit;
+ return rowHeaderRows.push(rowHeader);
};
buildValues = function(rowHeaderRows, colHeaderCols) {
var aggregator, colHeader, eventHandlers, flatColKey, flatRowKey, isColSubtotal, isRowSubtotal, k, l, len, len1, ref8, results, rowHeader, style, td, totalAggregator, tr, val;
results = [];
for (k = 0, len = rowHeaderRows.length; k < len; k++) {
rowHeader = rowHeaderRows[k];
- tr = rowHeader.tr;
+ setRowInitParams(rowHeader.col);
flatRowKey = rowHeader.flatKey;
isRowSubtotal = rowHeader.children.length !== 0;
+ tr = isRowSubtotal ? rowHeader.sTr : rowHeader.tr;
for (l = 0, len1 = colHeaderCols.length; l < len1; l++) {
colHeader = colHeaderCols[l];
flatColKey = colHeader.flatKey;
@@ -616,9 +663,9 @@
style += " pvtColSubtotal " + colClassOnInit;
}
if (isRowSubtotal) {
- style += " pvtRowSubtotal " + classRowExpanded;
+ style += " pvtRowSubtotal " + rowClassOnInit;
}
- style += isRowSubtotal && (isRowHideOnExpand || isRowDisable || rowHeader.col > rowDisableAfter) ? " " + classRowHide : " " + classRowShow;
+ style += isRowSubtotal && (isRowDisable || rowHeader.col > rowDisableAfter || (isRowHideOnExpand && rowHeader.col < rowsCollapseAt)) ? " " + classRowHide : " " + classRowShow;
style += isColSubtotal && (isColDisable || colHeader.col > colDisableAfter || (isColHideOnExpand && colHeader.col < colsCollapseAt)) ? " " + classColHide : " " + classColShow;
style += (" row" + rowHeader.row) + (" col" + colHeader.row) + (" rowcol" + rowHeader.col) + (" colcol" + colHeader.col);
eventHandlers = getTableEventHandlers(val, rowHeader.key, colHeader.key);
@@ -627,7 +674,7 @@
"data-rownode": rowHeader.node,
"data-colnode": colHeader.node
}, eventHandlers);
- if ((isRowSubtotal && (isRowHideOnExpand || isRowDisable || rowHeader.col > rowDisableAfter)) || isColDisable || colHeader.col > colDisableAfter || colHeader.col !== colsCollapseAt) {
+ if ((isRowSubtotal && (isRowDisable || rowHeader.col > rowDisableAfter || (isRowHideOnExpand && rowHeader.col < rowsCollapseAt))) || (isColSubtotal && (isColDisable || colHeader.col > colDisableAfter || colHeader.col > colsCollapseAt))) {
td.style.display = "none";
}
tr.appendChild(td);
@@ -638,7 +685,7 @@
if (isRowSubtotal) {
style += " pvtRowSubtotal";
}
- style += isRowSubtotal && (isRowHideOnExpand || isRowDisable || rowHeader.col > rowDisableAfter) ? " " + classRowHide : " " + classRowShow;
+ style += isRowSubtotal && (isRowDisable || rowHeader.col > rowDisableAfter || (isRowHideOnExpand && rowHeader.col < rowsCllapseAt)) ? " " + classRowHide : " " + classRowShow;
style += " row" + rowHeader.row + " rowcol" + rowHeader.col;
td = createElement("td", style, totalAggregator.format(val), {
"data-value": val,
@@ -646,7 +693,7 @@
"data-rowcol": "col" + rowHeader.col,
"data-rownode": rowHeader.node
}, getTableEventHandlers(val, rowHeader.key, []));
- if (isRowSubtotal && (isRowHideOnExpand || isRowDisable || rowHeader.col > rowDisableAfter)) {
+ if (isRowSubtotal && (isRowDisable || rowHeader.col > rowDisableAfter || (isRowHideOnExpand && rowHeader.col < rowsCllapseAt))) {
td.style.display = "none";
}
results.push(tr.appendChild(td));
@@ -676,14 +723,14 @@
if (isColSubtotal) {
style += " pvtColSubtotal";
}
- style += " " + classColExpanded;
+ style += " " + colClassOnInit;
style += " col" + h.row + " colcol" + h.col;
td = createElement("td", style, totalAggregator.format(val), {
"data-value": val,
"data-for": "col" + h.col,
"data-colnode": "" + h.node
}, getTableEventHandlers(val, [], h.key));
- if (isColDisable || h.col > colDisableAfter || h.col !== colsCollapseAt) {
+ if (isColSubtotal && (isColDisable || h.col > colDisableAfter || (isColHideOnExpand && h.col < colsCllapseAt))) {
td.style.display = "none";
}
results.push(tr.appendChild(td));
diff --git a/dist/subtotal.js.map b/dist/subtotal.js.map
index fec405b..dd0f8b6 100644
--- a/dist/subtotal.js.map
+++ b/dist/subtotal.js.map
@@ -1 +1 @@
-{"version":3,"file":"subtotal.js","sources":["subtotal.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;IAAA;;;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,IAAG,OAAO,OAAP,KAAkB,QAAlB,IAA+B,OAAO,MAAP,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EADJ;KAAA,MAEK,IAAG,OAAO,MAAP,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,CAAP,EAAmB,WAAnB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAJC;;EAHQ;;EASjB,cAAA,CAAe,SAAC,CAAD;AAEX,QAAA;IAAM;AACF,UAAA;;;;MAAa,2BAAC,KAAD,EAAQ,IAAR;QACT,mDAAM,KAAN,EAAa,IAAb;MADS;;MAGb,UAAA,GAAa,SAAC,MAA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AA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAFxC;QAGA,oCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAHxC;;IADuC,CAAA,CAAH,CAAU,mBAAV,EAAsC,2BAAtC;EAz7B7B,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\r\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\r\n pivotModule require(\"jquery\")\r\n else if typeof define is \"function\" and define.amd # AMD\r\n define [\"jquery\"], pivotModule\r\n # Plain browser env\r\n else\r\n pivotModule jQuery\r\n\r\ncallWithJQuery ($) ->\r\n\r\n class SubtotalPivotData extends $.pivotUtilities.PivotData\r\n constructor: (input, opts) ->\r\n super input, opts\r\n\r\n processKey = (record, totals, keys, attrs, getAggregator) ->\r\n key = []\r\n addKey = false\r\n for attr in attrs\r\n key.push record[attr] ? \"null\"\r\n flatKey = key.join String.fromCharCode(0)\r\n if not totals[flatKey]\r\n totals[flatKey] = getAggregator key.slice()\r\n addKey = true\r\n totals[flatKey].push record\r\n keys.push key if addKey\r\n return key\r\n\r\n processRecord: (record) -> #this code is called in a tight loop\r\n rowKey = []\r\n colKey = []\r\n\r\n @allTotal.push record\r\n rowKey = processKey record, @rowTotals, @rowKeys, @rowAttrs, (key) =>\r\n return @aggregator this, key, []\r\n colKey = processKey record, @colTotals, @colKeys, @colAttrs, (key) =>\r\n return @aggregator this, [], key\r\n m = rowKey.length-1\r\n n = colKey.length-1\r\n return if m < 0 or n < 0\r\n for i in [0..m]\r\n fRowKey = rowKey.slice(0, i+1)\r\n flatRowKey = fRowKey.join String.fromCharCode(0)\r\n @tree[flatRowKey] = {} if not @tree[flatRowKey]\r\n for j in [0..n]\r\n fColKey = colKey.slice 0, j+1\r\n flatColKey = fColKey.join String.fromCharCode(0)\r\n @tree[flatRowKey][flatColKey] = @aggregator this, fRowKey, fColKey if not @tree[flatRowKey][flatColKey]\r\n @tree[flatRowKey][flatColKey].push record\r\n\r\n $.pivotUtilities.SubtotalPivotData = SubtotalPivotData\r\n\r\n SubtotalRenderer = (pivotData, opts) ->\r\n defaults =\r\n table: clickCallback: null\r\n localeStrings: totals: \"Totals\"\r\n\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n isRowDisable = opts.rowSubtotalDisplay?.disableSubtotal\r\n isRowHideOnExpand = opts.rowSubtotalDisplay?.hideOnExpand\r\n isRowDisableExpandCollapse = opts.rowSubtotalDisplay?.disableExpandCollapse\r\n rowDisableAfter = if typeof opts.rowSubtotalDisplay?.disableAfter isnt 'undefined' then opts.rowSubtotalDisplay.disableAfter else 9999\r\n isColDisable = opts.colSubtotalDisplay?.disableSubtotal\r\n isColHideOnExpand = opts.colSubtotalDisplay?.hideOnExpand\r\n isColDisableExpandCollapse = opts.colSubtotalDisplay?.disableExpandCollapse\r\n colDisableAfter = if typeof opts.colSubtotalDisplay?.disableAfter isnt 'undefined' then opts.colSubtotalDisplay.disableAfter else 9999\r\n arrowCollapsed = opts.arrowCollapsed ?= \"\\u25B6\"\r\n arrowExpanded = opts.arrowExpanded ?= \"\\u25E2\"\r\n colsCollapseAt = if typeof opts.collapseColsAt isnt 'undefined' then opts.collapseColsAt else 9999\r\n rowsCollapseAt = if typeof opts.collapseRowsAt isnt 'undefined' then opts.collapseRowsAt else 9999\r\n\r\n colAttrs = pivotData.colAttrs\r\n rowAttrs = pivotData.rowAttrs\r\n rowKeys = pivotData.getRowKeys()\r\n colKeys = pivotData.getColKeys()\r\n tree = pivotData.tree\r\n rowTotals = pivotData.rowTotals\r\n colTotals = pivotData.colTotals\r\n allTotal = pivotData.allTotal\r\n\r\n classRowExpanded = \"rowexpanded\"\r\n classRowCollapsed = \"rowcollapsed\"\r\n classRowHide = \"rowhide\"\r\n classRowShow = \"rowshow\"\r\n classColExpanded = \"colexpanded\"\r\n classColCollapsed = \"colcollapsed\"\r\n classColHide = \"colhide\"\r\n classColShow = \"colshow\"\r\n clickStatusExpanded = \"expanded\"\r\n clickStatusCollapsed = \"collapsed\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n\r\n colArrowOnInit = arrowExpanded\r\n colClassOnInit = classColExpanded\r\n colClickStatusOnInit = clickStatusExpanded\r\n\r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- Begin\r\n hasClass = (element, className) ->\r\n regExp = new RegExp \"(?:^|\\\\s)\" + className + \"(?!\\\\S)\", \"g\"\r\n element.className.match(regExp) isnt null\r\n\r\n removeClass = (element, className) ->\r\n for name in className.split \" \"\r\n regExp = new RegExp \"(?:^|\\\\s)\" + name + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n for name in className.split \" \"\r\n element.className += (\" \" + name) if not hasClass element, name\r\n\r\n replaceClass = (element, replaceClassName, byClassName) ->\r\n removeClass element, replaceClassName\r\n addClass element, byClassName\r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- End\r\n\r\n getTableEventHandlers = (value, rowValues, colValues) ->\r\n return if not opts.table and not opts.table.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\r\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n createElement = (elementType, className, textContent, attributes, eventHandlers) ->\r\n e = document.createElement elementType\r\n e.className = className if className?\r\n e.textContent = textContent if textContent?\r\n e.setAttribute attr, val for own attr, val of attributes if attributes?\r\n e.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return e\r\n\r\n setAttributes = (e, attrs) ->\r\n for own a, v of attrs\r\n e.setAttribute a, v \r\n\r\n processKeys = (keysArr, className) ->\r\n headers = []\r\n lastRow = keysArr.length - 1\r\n lastCol = keysArr[0].length - 1\r\n rMark = []\r\n th = createElement \"th\", className, keysArr[0][0]\r\n key = []\r\n key.push keysArr[0][0]\r\n nodePos = 0\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: 0,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: lastCol,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n headers.push node\r\n rMark[0] = node\r\n c = 1\r\n while c <= lastCol\r\n th = createElement \"th\", className, keysArr[0][c]\r\n key = key.slice()\r\n key.push keysArr[0][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: c,\r\n th: th,\r\n parent: rMark[c-1],\r\n children: [],\r\n descendants: lastCol-c,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n rMark[c] = node\r\n rMark[c-1].children.push node\r\n ++c\r\n rMark[lastCol].leaves = 0\r\n r = 1\r\n while r <= lastRow\r\n repeats = true\r\n key = []\r\n c = 0\r\n while c <= lastCol\r\n key = key.slice()\r\n key.push keysArr[r][c]\r\n if ((keysArr[r][c] is keysArr[rMark[c].row][c]) and (c isnt lastCol) and (repeats))\r\n repeats = true\r\n ++c\r\n continue\r\n th = createElement \"th\", className, keysArr[r][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: r,\r\n col: c,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: 0,\r\n leaves: 0,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n if c is 0\r\n headers.push node\r\n else\r\n node.parent = rMark[c-1]\r\n rMark[c-1].children.push node\r\n x = 0\r\n while x <= c-1\r\n ++rMark[x].descendants\r\n ++x\r\n rMark[c] = node\r\n repeats = false\r\n ++c\r\n ++rMark[c].leaves for c in [0..lastCol]\r\n rMark[lastCol].leaves = 0\r\n ++r\r\n return headers\r\n\r\n setColInitParams = (col) ->\r\n colArrowOnInit = arrowExpanded\r\n colClassOnInit = classColExpanded\r\n colClickStatusOnInit = clickStatusExpanded\r\n\r\n if col >= colsCollapseAt and not (isColDisable or col > colDisableAfter) \r\n colArrowOnInit = arrowCollapsed\r\n colClassOnInit = classColCollapsed\r\n colClickStatusOnInit = clickStatusCollapsed\r\n\r\n buildColHeaderHeader = (thead, colHeaderHeaders, rowAttrs, colAttrs, tr, col) ->\r\n colAttr = colAttrs[col]\r\n textContent = colAttr\r\n className = \"pvtAxisLabel\"\r\n setColInitParams col\r\n if col < colAttrs.length-1\r\n className += \" \" + colClassOnInit\r\n textContent = \" \" + colArrowOnInit + \" \" + colAttr if not (isColDisableExpandCollapse or isColDisable or col > colDisableAfter)\r\n th = createElement \"th\", className, textContent\r\n th.setAttribute \"data-colAttr\", colAttr\r\n tr.appendChild th\r\n colHeaderHeaders.push {\r\n tr: tr,\r\n th: th,\r\n clickStatus: colClickStatusOnInit,\r\n expandedCount: 0,\r\n nHeaders: 0}\r\n thead.appendChild tr\r\n\r\n buildColHeaderHeaders = (thead, colHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n if rowAttrs.length != 0\r\n tr.appendChild createElement \"th\", null, null, {\r\n colspan: rowAttrs.length,\r\n rowspan: colAttrs.length}\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, 0\r\n for c in [1..colAttrs.length] when c < colAttrs.length\r\n tr = createElement(\"tr\")\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, c\r\n\r\n buildColHeaderHeadersClickEvents = (colHeaderHeaders, colHeaderCols, colAttrs) ->\r\n n = colAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = colHeaderHeaders[i].th\r\n colAttr = colAttrs[i]\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleColHeaderHeader colHeaderHeaders, colHeaderCols, colAttrs, event.target.getAttribute \"data-colAttr\"\r\n\r\n buildColHeaders = (colHeaderHeaders, colHeaderCols, colHeader, rowAttrs, colAttrs) ->\r\n # DF Recurse\r\n for h in colHeader.children\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs\r\n # Process\r\n #\r\n # NOTE:\r\n # \r\n # We replace colHeader.node with colHeaderCols.length.\r\n # colHeader.node is not useful as columns are positioned depth-first \r\n #\r\n setColInitParams colHeader.col\r\n isColSubtotal = colHeader.children.length != 0\r\n colHeader.node = colHeaderCols.length\r\n hh = colHeaderHeaders[colHeader.col]\r\n ++hh.expandedCount if colHeader.col <= colsCollapseAt\r\n ++hh.nHeaders\r\n tr = hh.tr\r\n th = colHeader.th\r\n addClass th, \"col#{colHeader.row} colcol#{colHeader.col} #{classColShow}\"\r\n colspan = 1\r\n if isColDisable or colHeader.col > colDisableAfter\r\n colspan = colHeader.leaves\r\n else if isColSubtotal and colHeader.col < colsCollapseAt\r\n colspan = 0;\r\n for ch in colHeader.children\r\n colspan += parseInt(ch.th.getAttribute \"colspan\")\r\n colspan += 1 if not isColHideOnExpand\r\n setAttributes th,\r\n \"rowspan\": if colHeader.col == colAttrs.length-1 and rowAttrs.length != 0 then 2 else 1\r\n \"colspan\": colspan, \r\n \"data-colnode\": colHeader.node,\r\n \"data-colHeader\": th.textContent\r\n if isColSubtotal\r\n addClass th, colClassOnInit\r\n th.textContent = \" #{colArrowOnInit} #{th.textContent}\" if not\r\n (isColDisable or colHeader.col > colDisableAfter or isColDisableExpandCollapse)\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleCol colHeaderHeaders, colHeaderCols, parseInt event.target.getAttribute \"data-colnode\"\r\n rowspan = colAttrs.length-(colHeader.col+1) + if rowAttrs.length != 0 then 1 else 0\r\n style = \"pvtColLabel pvtColSubtotal #{colClassOnInit}\"\r\n style += \" col#{colHeader.row} colcol#{colHeader.col}\"\r\n # style += \" #{classColHide}\" if isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt)\r\n sTh = createElement \"th\", style, '', {\"rowspan\": rowspan, \"data-colnode\": colHeader.node}\r\n addClass sTh, if isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt) then \" #{classColHide}\" else \" #{classColShow}\"\r\n sTh.style.display = \"none\" if isColDisable or colHeader.col > colDisableAfter or colHeader.col != colsCollapseAt\r\n colHeader.children[0].tr.appendChild sTh\r\n colHeader.sTh = sTh\r\n th.style.display = \"none\" if (colHeader.col > colDisableAfter and isColSubtotal) or colHeader.col > colsCollapseAt\r\n colHeader.clickStatus = colClickStatusOnInit\r\n tr.appendChild(th)\r\n colHeader.tr = tr\r\n colHeaderCols.push colHeader\r\n\r\n buildRowHeaderHeaders = (thead, rowHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n rowHeaderHeaders.hh = []\r\n for own i, rowAttr of rowAttrs\r\n textContent = rowAttr\r\n className = \"pvtAxisLabel\"\r\n if i < rowAttrs.length-1\r\n className += \" expanded\"\r\n textContent = \" \" + arrowExpanded + \" \" + rowAttr if not (isRowDisableExpandCollapse or isRowDisable or i > rowDisableAfter)\r\n th = createElement \"th\", className, textContent\r\n th.setAttribute \"data-rowAttr\", rowAttr\r\n tr.appendChild th\r\n rowHeaderHeaders.hh.push \r\n th: th,\r\n clickStatus: clickStatusExpanded,\r\n expandedCount: 0,\r\n nHeaders: 0\r\n if colAttrs.length != 0\r\n th = createElement \"th\"\r\n tr.appendChild th\r\n thead.appendChild tr\r\n rowHeaderHeaders.tr = tr\r\n\r\n buildRowHeaderHeadersClickEvents = (rowHeaderHeaders, rowHeaderRows, rowAttrs) ->\r\n n = rowAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = rowHeaderHeaders.hh[i]\r\n rowAttr = rowAttrs[i]\r\n th.th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRowHeaderHeader rowHeaderHeaders, rowHeaderRows, rowAttrs, event.target.getAttribute \"data-rowAttr\"\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n rowspan = 1\r\n if colAttrs.length != 0\r\n rowspan = colAttrs.length + (if rowAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals, {rowspan: rowspan}\r\n tr.appendChild th\r\n\r\n buildRowHeaders = (tbody, rowHeaderHeaders, rowHeaderRows, rowHeader, rowAttrs, colAttrs) ->\r\n hh = rowHeaderHeaders.hh[rowHeader.col]\r\n ++hh.expandedCount\r\n ++hh.nHeaders\r\n tr = createElement \"tr\", \"pvtRowSubtotal row#{rowHeader.row}\", \"\", \"data-rownode\": rowHeader.node \r\n th = rowHeader.th\r\n isRowSubtotal = rowHeader.children.length != 0;\r\n addClass th, \"row#{rowHeader.row} rowcol#{rowHeader.col} #{classRowShow}\"\r\n setAttributes th,\r\n \"data-rowHeader\": th.textContent,\r\n \"data-rownode\": rowHeader.node,\r\n \"rowspan\": rowHeader.descendants+1,\r\n \"colspan\": if rowHeader.col == rowAttrs.length-1 and colAttrs.length != 0 then 2 else 1\r\n tr.appendChild th\r\n if isRowSubtotal\r\n addClass tr, classRowExpanded\r\n addClass th, classRowExpanded\r\n th.textContent = \" \" + arrowExpanded + \" \" + th.textContent if not (isRowDisableExpandCollapse or isRowDisable or rowHeader.col > rowDisableAfter)\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRow rowHeaderHeaders, rowHeaderRows, parseInt event.target.getAttribute \"data-rownode\"\r\n # Filler th\r\n colspan = rowAttrs.length-(rowHeader.col+1) + if colAttrs.length != 0 then 1 else 0\r\n style = \"pvtRowLabel pvtRowSubtotal #{classRowExpanded}\"\r\n style += \" row#{rowHeader.row} rowcol#{rowHeader.col}\"\r\n style += if isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n th = createElement \"th\", style, '', {\"colspan\": colspan, \"data-rownode\": rowHeader.node}\r\n th.style.display = \"none\" if isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter\r\n tr.appendChild th\r\n rowHeader.clickStatus = clickStatusExpanded\r\n rowHeader.tr = tr\r\n rowHeaderRows.push rowHeader\r\n tbody.appendChild tr\r\n for h in rowHeader.children\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs\r\n\r\n buildValues = (rowHeaderRows, colHeaderCols) ->\r\n for rowHeader in rowHeaderRows\r\n tr = rowHeader.tr\r\n flatRowKey = rowHeader.flatKey\r\n isRowSubtotal = rowHeader.children.length != 0;\r\n for colHeader in colHeaderCols\r\n flatColKey = colHeader.flatKey\r\n aggregator = tree[flatRowKey][flatColKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n isColSubtotal = colHeader.children.length != 0;\r\n setColInitParams colHeader.col\r\n style = \"pvtVal\"\r\n style += \" pvtColSubtotal #{colClassOnInit}\" if isColSubtotal\r\n style += \" pvtRowSubtotal #{classRowExpanded}\" if isRowSubtotal\r\n style += if isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter) then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n style += if isColSubtotal and (isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt)) then \" #{classColHide}\" else \" #{classColShow}\"\r\n style += \" row#{rowHeader.row}\" +\r\n \" col#{colHeader.row}\" +\r\n \" rowcol#{rowHeader.col}\" +\r\n \" colcol#{colHeader.col}\"\r\n eventHandlers = getTableEventHandlers val, rowHeader.key, colHeader.key\r\n td = createElement \"td\", style, aggregator.format(val),\r\n \"data-value\": val,\r\n \"data-rownode\": rowHeader.node,\r\n \"data-colnode\": colHeader.node, eventHandlers\r\n td.style.display = \"none\" if (isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter)) or isColDisable or colHeader.col > colDisableAfter or colHeader.col != colsCollapseAt\r\n # or (colHeader.col > colsCollapseAt)\r\n tr.appendChild td\r\n # buildRowTotal\r\n totalAggregator = rowTotals[flatRowKey]\r\n val = totalAggregator.value()\r\n style = \"pvtTotal rowTotal\"\r\n style += \" pvtRowSubtotal\" if isRowSubtotal \r\n style += if isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter) then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n style += \" row#{rowHeader.row} rowcol#{rowHeader.col}\"\r\n td = createElement \"td\", style, totalAggregator.format(val),\r\n \"data-value\": val,\r\n \"data-row\": \"row#{rowHeader.row}\",\r\n \"data-rowcol\": \"col#{rowHeader.col}\",\r\n \"data-rownode\": rowHeader.node, getTableEventHandlers val, rowHeader.key, []\r\n td.style.display = \"none\" if isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter)\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, colHeaderCols) ->\r\n for h in colHeaderCols\r\n isColSubtotal = h.children.length != 0\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n setColInitParams h.col\r\n style = \"pvtVal pvtTotal colTotal\"\r\n style += \" pvtColSubtotal\" if isColSubtotal\r\n style += \" #{classColExpanded}\"\r\n style += \" col#{h.row} colcol#{h.col}\"\r\n td = createElement \"td\", style, totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-for\": \"col#{h.col}\"\r\n \"data-colnode\": \"#{h.node}\", getTableEventHandlers val, [], h.key\r\n td.style.display = \"none\" if isColDisable or h.col > colDisableAfter or h.col != colsCollapseAt\r\n # or (h.col > colsCollapseAt)\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (result, tr) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], []\r\n tr.appendChild td\r\n result.appendChild tr\r\n\r\n\r\n hideDescendantCol = (d) ->\r\n $(d.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{d.node}\\\"], th[data-colnode=\\\"#{d.node}\\\"]\" \r\n .removeClass classColShow \r\n .addClass classColHide \r\n .css 'display', \"none\" \r\n\r\n collapseShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColExpanded} #{classColHide}\"\r\n .addClass \"#{classColCollapsed} #{classColShow}\"\r\n .not \".pvtRowSubtotal.#{classRowHide}\"\r\n .css 'display', \"\" \r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-colheader\"\r\n h.th.colSpan = 1\r\n\r\n collapseCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if isColDisable\r\n return if isColDisableExpandCollapse\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.col > colDisableAfter\r\n return if h.clickStatus is clickStatusCollapsed\r\n\r\n isColSubtotal = h.descendants != 0\r\n colspan = h.th.colSpan \r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = colHeaderCols[c-i]\r\n hideDescendantCol d\r\n if isColSubtotal \r\n collapseShowColSubtotal h\r\n --colspan\r\n p = h.parent\r\n while p isnt null\r\n p.th.colSpan -= colspan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n colHeaderHeader = colHeaderHeaders[h.col]\r\n colHeaderHeader.expandedCount--\r\n if colHeaderHeader.expandedCount == 0\r\n for i in [h.col..colHeaderHeaders.length-2] when i <= colDisableAfter\r\n colHeaderHeader = colHeaderHeaders[i]\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colHeaderHeader.th.getAttribute \"data-colAttr\"\r\n colHeaderHeader.clickStatus = clickStatusCollapsed\r\n\r\n showChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColHide\r\n .addClass classColShow\r\n .not \".pvtRowSubtotal.#{classRowHide}\"\r\n .css 'display', \"\" \r\n\r\n expandHideColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColShow}\" \r\n .addClass \"#{classColExpanded} #{classColHide}\" \r\n .css 'display', \"none\" \r\n h.th.style.display = \"\"\r\n\r\n expandShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColHide}\"\r\n .addClass \"#{classColExpanded} #{classColShow}\"\r\n .not \".pvtRowSubtotal.#{classRowHide}\"\r\n .css 'display', \"\" \r\n h.th.style.display = \"\"\r\n ++h.th.colSpan\r\n h.sTh.style.display = \"\" if h.sTh?\r\n\r\n expandChildCol = (ch) ->\r\n if ch.descendants != 0 and hasClass(ch.th, classColExpanded) and (isColDisable or ch.col > colDisableAfter or isColHideOnExpand)\r\n ch.th.style.display = \"\"\r\n else\r\n showChildCol ch\r\n expandChildCol gch for gch in ch.children if ch.clickStatus isnt clickStatusCollapsed\r\n\r\n expandCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if isColDisable\r\n return if isColDisableExpandCollapse\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.col > colDisableAfter\r\n return if h.clickStatus is clickStatusExpanded\r\n\r\n isColSubtotal = h.descendants != 0\r\n colspan = 0\r\n for ch in h.children\r\n expandChildCol ch\r\n colspan += ch.th.colSpan\r\n h.th.colSpan = colspan\r\n if isColSubtotal\r\n replaceClass h.th, classColCollapsed, classColExpanded\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-colHeader\"\r\n if isColHideOnExpand\r\n expandHideColSubtotal h\r\n --colspan\r\n else\r\n expandShowColSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.colSpan += colspan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n hh = colHeaderHeaders[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount is hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-colAttr\"\r\n hh.clickStatus = clickStatusExpanded\r\n\r\n collapseHideDescendantRow = (h) ->\r\n h.tr.style.display = \"none\"\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n replaceClass cell, classRowShow, classRowHide\r\n cell.style.display = \"none\"\r\n\r\n collapseShowRowSubtotal = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n cell.style.display = \"\" if not hasClass cell, classColHide\r\n h.th.rowSpan = 1\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n replaceClass h.tr, classRowExpanded, classRowCollapsed\r\n\r\n collapseRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if isRowDisable\r\n return if isRowDisableExpandCollapse\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.col > rowDisableAfter\r\n return if h.clickStatus is clickStatusCollapsed\r\n\r\n isRowSubtotal = h.descendants != 0\r\n rowspan = h.th.rowSpan \r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = rowHeaderRows[r+i]\r\n collapseHideDescendantRow d\r\n if isRowSubtotal\r\n collapseShowRowSubtotal h\r\n --rowspan\r\n p = h.parent\r\n while p\r\n p.th.rowSpan -= rowspan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n\r\n hh = rowHeaderHeaders.hh[h.col]\r\n hh.expandedCount--\r\n\r\n return if hh.expandedCount != 0\r\n\r\n for j in [h.col..rowHeaderHeaders.hh.length-2] when j <= rowDisableAfter\r\n hh = rowHeaderHeaders.hh[j]\r\n replaceClass hh.th, classExpanded, classCollapsed\r\n hh.th.textContent = \" \" + arrowCollapsed + \" \" + hh.th.getAttribute \"data-rowAttr\"\r\n hh.clickStatus = clickStatusCollapsed\r\n\r\n showChildRow = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n replaceClass cell, classRowHide, classRowShow\r\n cell.style.display = \"\" if not hasClass cell, classColHide\r\n h.tr.style.display = \"\"\r\n\r\n expandShowRowSubtotal = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\" \r\n cell.style.display = \"\" if not hasClass cell, classColHide\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n replaceClass h.tr, classRowCollapsed, classRowExpanded\r\n\r\n expandHideRowSubtotal = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n cell.style.display = \"none\"\r\n h.th.style.display = \"\"\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n replaceClass h.tr, classRowCollapsed, classRowExpanded\r\n\r\n expandChildRow = (ch) ->\r\n if ch.descendants != 0 and hasClass(ch.th, classRowExpanded) and (isRowHideOnExpand or isRowDisable or ch.col > rowDisableAfter)\r\n ch.tr.style.display = \"\"\r\n ch.th.style.display = \"\"\r\n else\r\n showChildRow ch\r\n expandChildRow gch for gch in ch.children if ch.clickStatus isnt clickStatusCollapsed\r\n\r\n expandRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if isRowDisable\r\n return if isRowDisableExpandCollapse\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.col > rowDisableAfter\r\n return if h.clickStatus is clickStatusExpanded\r\n\r\n isRowSubtotal = h.descendants != 0\r\n rowspan = 0\r\n for ch in h.children\r\n expandChildRow ch\r\n rowspan += ch.th.rowSpan\r\n h.th.rowSpan = rowspan+1\r\n if isRowSubtotal\r\n if isRowHideOnExpand\r\n expandHideRowSubtotal h\r\n else\r\n expandShowRowSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.rowSpan += rowspan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n hh = rowHeaderHeaders.hh[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount == hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-rowAttr\"\r\n hh.clickStatus = clickStatusExpanded\r\n\r\n toggleCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]?\r\n\r\n h = colHeaderCols[c]\r\n if h.clickStatus is clickStatusCollapsed\r\n expandCol(colHeaderHeaders, colHeaderCols, c)\r\n else\r\n collapseCol(colHeaderHeaders, colHeaderCols, c)\r\n h.th.scrollIntoView\r\n\r\n toggleRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]?\r\n\r\n if rowHeaderRows[r].clickStatus is clickStatusCollapsed\r\n expandRow(rowHeaderHeaders, rowHeaderRows, r)\r\n else\r\n collapseRow(rowHeaderHeaders, rowHeaderRows, r)\r\n\r\n collapseColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n return if isColDisable\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n i = idx\r\n nAttrs = colAttrs.length-1\r\n while i < nAttrs and i <= colDisableAfter\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classExpanded, classCollapsed\r\n hh.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[i]\r\n hh.clickStatus = clickStatusCollapsed\r\n ++i\r\n i = 0\r\n nCols = colHeaderCols.length\r\n while i < nCols\r\n h = colHeaderCols[i]\r\n if h.col is idx and h.clickStatus isnt clickStatusCollapsed and h.th.style.display isnt \"none\"\r\n collapseCol colHeaderHeaders, colHeaderCols, parseInt h.th.getAttribute(\"data-colnode\")\r\n ++i\r\n\r\n expandColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n return if isColDisable\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n for i in [0..idx]\r\n if i <= colDisableAfter\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[i]\r\n hh.clickStatus = clickStatusExpanded\r\n j = 0\r\n nCols = colHeaderCols.length\r\n while j < nCols\r\n h = colHeaderCols[j]\r\n expandCol colHeaderHeaders, colHeaderCols, j if h.col == i\r\n ++j\r\n ++idx\r\n while idx < colAttrs.length-1 and idx <= colDisableAfter\r\n colHeaderHeader = colHeaderHeaders[idx]\r\n if colHeaderHeader.expandedCount == 0\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = clickStatusCollapsed\r\n else if colHeaderHeader.expandedCount == colHeaderHeader.nHeaders\r\n replaceClass colHeaderHeader.th, classCollapsed, classExpanded\r\n colHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = clickStatusExpanded\r\n ++idx\r\n\r\n collapseRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n return if isRowDisable\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n i = idx\r\n nAttrs = rowAttrs.length-1\r\n while i < nAttrs and i <= rowDisableAfter\r\n h = rowHeaderHeaders.hh[i]\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[i]\r\n h.clickStatus = clickStatusCollapsed\r\n ++i\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col is idx and h.clickStatus isnt clickStatusCollapsed and h.tr.style.display isnt \"none\"\r\n collapseRow rowHeaderHeaders, rowHeaderRows, j\r\n j = j + h.descendants + 1\r\n else\r\n ++j\r\n\r\n expandRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n return if isRowDisable\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n for i in [0..idx]\r\n if i <= rowDisableAfter\r\n hh = rowHeaderHeaders.hh[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[i]\r\n hh.clickStatus = clickStatusExpanded\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col == i\r\n expandRow(rowHeaderHeaders, rowHeaderRows, j)\r\n j += h.descendants + 1\r\n else\r\n ++j\r\n ++idx\r\n while idx < rowAttrs.length-1 and idx <= rowDisableAfter\r\n rowHeaderHeader = rowHeaderHeaders.hh[idx]\r\n if rowHeaderHeader.expandedCount == 0\r\n replaceClass rowHeaderHeader.th, classExpanded, classCollapsed\r\n rowHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = clickStatusCollapsed\r\n else if rowHeaderHeader.expandedCount == rowHeaderHeader.nHeaders\r\n replaceClass rowHeaderHeader.th, classCollapsed, classExpanded\r\n rowHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = clickStatusExpanded\r\n ++idx\r\n\r\n toggleColHeaderHeader = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n return if isColDisable\r\n return if isColDisableExpandCollapse\r\n\r\n idx = colAttrs.indexOf colAttr\r\n h = colHeaderHeaders[idx]\r\n return if h.col > colDisableAfter\r\n if h.clickStatus is clickStatusCollapsed\r\n expandColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n else\r\n collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n\r\n\r\n toggleRowHeaderHeader = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n return if isRowDisable\r\n return if isRowDisableExpandCollapse\r\n\r\n idx = rowAttrs.indexOf rowAttr\r\n th = rowHeaderHeaders.hh[idx]\r\n return if th.col > rowDisableAfter\r\n if th.clickStatus is clickStatusCollapsed\r\n expandRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n else\r\n collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowHeaders = []\r\n colHeaders = []\r\n rowHeaderHeaders = {}\r\n rowHeaderRows = []\r\n colHeaderHeaders = []\r\n colHeaderCols = []\r\n\r\n rowHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length > 0 and rowKeys.length > 0\r\n colHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length > 0 and colKeys.length > 0\r\n\r\n result = createElement \"table\", \"pvtTable\", null, {style: \"display: none;\"}\r\n\r\n thead = createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length > 0\r\n buildColHeaderHeaders thead, colHeaderHeaders, rowAttrs, colAttrs\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs for h in colHeaders\r\n buildColHeaderHeadersClickEvents colHeaderHeaders, colHeaderCols, colAttrs\r\n\r\n if rowAttrs.length > 0\r\n buildRowHeaderHeaders thead, rowHeaderHeaders, rowAttrs, colAttrs\r\n buildRowTotalsHeader rowHeaderHeaders.tr, rowAttrs, colAttrs if colAttrs.length == 0\r\n\r\n if colAttrs.length > 0\r\n buildRowTotalsHeader colHeaderHeaders[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = createElement \"tbody\"\r\n result.appendChild tbody\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs for h in rowHeaders if rowAttrs.length > 0\r\n buildRowHeaderHeadersClickEvents rowHeaderHeaders, rowHeaderRows, rowAttrs\r\n buildValues rowHeaderRows, colHeaderCols\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colHeaderCols if colAttrs.length > 0\r\n buildGrandTotal tbody, tr\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\r\n # result.style.display = \"\" if not opts.collapseRowsAt? and not opts.collapseColsAt?\r\n # collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, opts.collapseRowsAt if opts.collapseRowsAt?\r\n # if not opts.collapseColsAt?\r\n # result.style.display = \"\"\r\n # return result\r\n # collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, opts.collapseColsAt if opts.collapseColsAt?\r\n result.style.display = \"\"\r\n\r\n return result\r\n\r\n return main rowAttrs, rowKeys, colAttrs, colKeys\r\n\r\n $.pivotUtilities.subtotal_renderers =\r\n \"Table With Subtotal\": (pvtData, opts) -> SubtotalRenderer pvtData, opts\r\n \"Table With Subtotal Bar Chart\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).barchart()\r\n \"Table With Subtotal Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"heatmap\", opts\r\n \"Table With Subtotal Row Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"rowheatmap\", opts\r\n \"Table With Subtotal Col Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"colheatmap\", opts\r\n\r\n #\r\n # \r\n # Aggregators\r\n # \r\n #\r\n\r\n usFmtPct = $.pivotUtilities.numberFormat digitsAfterDecimal:1, scaler: 100, suffix: \"%\"\r\n aggregatorTemplates = $.pivotUtilities.aggregatorTemplates;\r\n\r\n subtotalAggregatorTemplates =\r\n fractionOf: (wrapped, type=\"row\", formatter=usFmtPct) -> (x...) -> (data, rowKey, colKey) ->\r\n rowKey = [] if typeof rowKey is \"undefined\"\r\n colKey = [] if typeof colKey is \"undefined\"\r\n selector: {row: [rowKey.slice(0, -1),[]], col: [[], colKey.slice(0, -1)]}[type]\r\n inner: wrapped(x...)(data, rowKey, colKey)\r\n push: (record) -> @inner.push record\r\n format: formatter\r\n value: -> @inner.value() / data.getAggregator(@selector...).inner.value()\r\n numInputs: wrapped(x...)().numInputs\r\n\r\n $.pivotUtilities.subtotalAggregatorTemplates = subtotalAggregatorTemplates\r\n\r\n $.pivotUtilities.subtotal_aggregators = do (tpl = aggregatorTemplates, sTpl = subtotalAggregatorTemplates) ->\r\n \"Sum As Fraction Of Parent Row\": sTpl.fractionOf(tpl.sum(), \"row\", usFmtPct)\r\n \"Sum As Fraction Of Parent Column\": sTpl.fractionOf(tpl.sum(), \"col\", usFmtPct)\r\n \"Count As Fraction Of Parent Row\": sTpl.fractionOf(tpl.count(), \"row\", usFmtPct)\r\n \"Count As Fraction Of Parent Column\": sTpl.fractionOf(tpl.count(), \"col\", usFmtPct)\r\n\r\n"]}
\ No newline at end of file
+{"version":3,"file":"subtotal.js","sources":["subtotal.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;IAAA;;;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,IAAG,OAAO,OAAP,KAAkB,QAAlB,IAA+B,OAAO,MAAP,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EADJ;KAAA,MAEK,IAAG,OAAO,MAAP,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,CAAP,EAAmB,WAAnB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAJC;;EAHQ;;EASjB,cAAA,CAAe,SAAC,CAAD;AAEX,QAAA;IAAM;AACF,UAAA;;;;MAAa,2BAAC,KAAD,EAAQ,IAAR;QACT,mDAAM,KAAN,EAAa,IAAb;MADS;;MAGb,UAAA,GAAa,SAAC,MAAD,EAAS,MAAT,EAAiB,IAAjB,EAAuB,KAAvB,EAA8B,aAA9B;AACT,YAAA;QAAA,GAAA,GAAM;QACN,MAAA,GAAS;AACT,aAAA,uCAAA;;UACI,GAAG,CAAC,IAAJ,sCAAwB,MAAxB;UACA,OAAA,GAAU,GAAG,CAAC,IAAJ,CAAS,MAAM,CAAC,YAAP,CAAoB,CAApB,CAAT;UACV,IAAG,CAAI,MAAO,CAAA,OAAA,CAAd;YACI,MAAO,CAAA,OAAA,CAAP,GAAkB,aAAA,CAAc,GAAG,CAAC,KAAJ,CAAA,CAAd;YAClB,MAAA,GAAS,KAFb;;UAGA,MAAO,CAAA,OAAA,CAAQ,CAAC,IAAhB,CAAqB,MAArB;AANJ;QAOA,IAAiB,M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,CAAC,cAAc,CAAC,oBAAjB,GAA2C,CAAA,SAAC,GAAD,EAA4B,IAA5B;aACvC;QAAA,+BAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,GAAJ,CAAA,CAAhB,EAA2B,KAA3B,EAAkC,QAAlC,CAAxC;QACA,kCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,GAAJ,CAAA,CAAhB,EAA2B,KAA3B,EAAkC,QAAlC,CADxC;QAEA,iCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAFxC;QAGA,oCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAHxC;;IADuC,CAAA,CAAH,CAAU,mBAAV,EAAsC,2BAAtC;EA1+B7B,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\r\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\r\n pivotModule require(\"jquery\")\r\n else if typeof define is \"function\" and define.amd # AMD\r\n define [\"jquery\"], pivotModule\r\n # Plain browser env\r\n else\r\n pivotModule jQuery\r\n\r\ncallWithJQuery ($) ->\r\n\r\n class SubtotalPivotData extends $.pivotUtilities.PivotData\r\n constructor: (input, opts) ->\r\n super input, opts\r\n\r\n processKey = (record, totals, keys, attrs, getAggregator) ->\r\n key = []\r\n addKey = false\r\n for attr in attrs\r\n key.push record[attr] ? \"null\"\r\n flatKey = key.join String.fromCharCode(0)\r\n if not totals[flatKey]\r\n totals[flatKey] = getAggregator key.slice()\r\n addKey = true\r\n totals[flatKey].push record\r\n keys.push key if addKey\r\n return key\r\n\r\n processRecord: (record) -> #this code is called in a tight loop\r\n rowKey = []\r\n colKey = []\r\n\r\n @allTotal.push record\r\n rowKey = processKey record, @rowTotals, @rowKeys, @rowAttrs, (key) =>\r\n return @aggregator this, key, []\r\n colKey = processKey record, @colTotals, @colKeys, @colAttrs, (key) =>\r\n return @aggregator this, [], key\r\n m = rowKey.length-1\r\n n = colKey.length-1\r\n return if m < 0 or n < 0\r\n for i in [0..m]\r\n fRowKey = rowKey.slice(0, i+1)\r\n flatRowKey = fRowKey.join String.fromCharCode(0)\r\n @tree[flatRowKey] = {} if not @tree[flatRowKey]\r\n for j in [0..n]\r\n fColKey = colKey.slice 0, j+1\r\n flatColKey = fColKey.join String.fromCharCode(0)\r\n @tree[flatRowKey][flatColKey] = @aggregator this, fRowKey, fColKey if not @tree[flatRowKey][flatColKey]\r\n @tree[flatRowKey][flatColKey].push record\r\n\r\n $.pivotUtilities.SubtotalPivotData = SubtotalPivotData\r\n\r\n SubtotalRenderer = (pivotData, opts) ->\r\n defaults =\r\n table: clickCallback: null\r\n localeStrings: totals: \"Totals\"\r\n\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n isRowDisable = opts.rowSubtotalDisplay?.disableSubtotal\r\n isRowHideOnExpand = opts.rowSubtotalDisplay?.hideOnExpand\r\n isRowDisableExpandCollapse = opts.rowSubtotalDisplay?.disableExpandCollapse\r\n rowDisableAfter = if typeof opts.rowSubtotalDisplay?.disableAfter isnt 'undefined' then opts.rowSubtotalDisplay.disableAfter else 9999\r\n isColDisable = opts.colSubtotalDisplay?.disableSubtotal\r\n isColHideOnExpand = opts.colSubtotalDisplay?.hideOnExpand\r\n isColDisableExpandCollapse = opts.colSubtotalDisplay?.disableExpandCollapse\r\n colDisableAfter = if typeof opts.colSubtotalDisplay?.disableAfter isnt 'undefined' then opts.colSubtotalDisplay.disableAfter else 9999\r\n arrowCollapsed = opts.arrowCollapsed ?= \"\\u25B6\"\r\n arrowExpanded = opts.arrowExpanded ?= \"\\u25E2\"\r\n colsCollapseAt = if typeof opts.collapseColsAt isnt 'undefined' then opts.collapseColsAt else 9999\r\n rowsCollapseAt = if typeof opts.collapseRowsAt isnt 'undefined' then opts.collapseRowsAt else 9999\r\n\r\n colAttrs = pivotData.colAttrs\r\n rowAttrs = pivotData.rowAttrs\r\n rowKeys = pivotData.getRowKeys()\r\n colKeys = pivotData.getColKeys()\r\n tree = pivotData.tree\r\n rowTotals = pivotData.rowTotals\r\n colTotals = pivotData.colTotals\r\n allTotal = pivotData.allTotal\r\n\r\n classRowExpanded = \"rowexpanded\"\r\n classRowCollapsed = \"rowcollapsed\"\r\n classRowHide = \"rowhide\"\r\n classRowShow = \"rowshow\"\r\n classColExpanded = \"colexpanded\"\r\n classColCollapsed = \"colcollapsed\"\r\n classColHide = \"colhide\"\r\n classColShow = \"colshow\"\r\n clickStatusExpanded = \"expanded\"\r\n clickStatusCollapsed = \"collapsed\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n\r\n colArrowOnInit = arrowExpanded\r\n colClassOnInit = classColExpanded\r\n colClickStatusOnInit = clickStatusExpanded\r\n\r\n rowArrowOnInit = arrowExpanded\r\n rowClassOnInit = classRowExpanded\r\n rowClickStatusOnInit = clickStatusExpanded\r\n \r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- Begin\r\n hasClass = (element, className) ->\r\n regExp = new RegExp \"(?:^|\\\\s)\" + className + \"(?!\\\\S)\", \"g\"\r\n element.className.match(regExp) isnt null\r\n\r\n removeClass = (element, className) ->\r\n for name in className.split \" \"\r\n regExp = new RegExp \"(?:^|\\\\s)\" + name + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n for name in className.split \" \"\r\n element.className += (\" \" + name) if not hasClass element, name\r\n\r\n replaceClass = (element, replaceClassName, byClassName) ->\r\n removeClass element, replaceClassName\r\n addClass element, byClassName\r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- End\r\n\r\n getTableEventHandlers = (value, rowValues, colValues) ->\r\n return if not opts.table and not opts.table.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\r\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n createElement = (elementType, className, textContent, attributes, eventHandlers) ->\r\n e = document.createElement elementType\r\n e.className = className if className?\r\n e.textContent = textContent if textContent?\r\n e.setAttribute attr, val for own attr, val of attributes if attributes?\r\n e.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return e\r\n\r\n setAttributes = (e, attrs) ->\r\n for own a, v of attrs\r\n e.setAttribute a, v \r\n\r\n processKeys = (keysArr, className) ->\r\n headers = []\r\n lastRow = keysArr.length - 1\r\n lastCol = keysArr[0].length - 1\r\n rMark = []\r\n th = createElement \"th\", className, keysArr[0][0]\r\n key = []\r\n key.push keysArr[0][0]\r\n nodePos = 0\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: 0,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: lastCol,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n headers.push node\r\n rMark[0] = node\r\n c = 1\r\n while c <= lastCol\r\n th = createElement \"th\", className, keysArr[0][c]\r\n key = key.slice()\r\n key.push keysArr[0][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: c,\r\n th: th,\r\n parent: rMark[c-1],\r\n children: [],\r\n descendants: lastCol-c,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n rMark[c] = node\r\n rMark[c-1].children.push node\r\n ++c\r\n rMark[lastCol].leaves = 0\r\n r = 1\r\n while r <= lastRow\r\n repeats = true\r\n key = []\r\n c = 0\r\n while c <= lastCol\r\n key = key.slice()\r\n key.push keysArr[r][c]\r\n if ((keysArr[r][c] is keysArr[rMark[c].row][c]) and (c isnt lastCol) and (repeats))\r\n repeats = true\r\n ++c\r\n continue\r\n th = createElement \"th\", className, keysArr[r][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: r,\r\n col: c,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: 0,\r\n leaves: 0,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n if c is 0\r\n headers.push node\r\n else\r\n node.parent = rMark[c-1]\r\n rMark[c-1].children.push node\r\n x = 0\r\n while x <= c-1\r\n ++rMark[x].descendants\r\n ++x\r\n rMark[c] = node\r\n repeats = false\r\n ++c\r\n ++rMark[c].leaves for c in [0..lastCol]\r\n rMark[lastCol].leaves = 0\r\n ++r\r\n return headers\r\n\r\n setColInitParams = (col) ->\r\n colArrowOnInit = arrowExpanded\r\n colClassOnInit = classColExpanded\r\n colClickStatusOnInit = clickStatusExpanded\r\n\r\n if col >= colsCollapseAt and not (isColDisable or col > colDisableAfter) \r\n colArrowOnInit = arrowCollapsed\r\n colClassOnInit = classColCollapsed\r\n colClickStatusOnInit = clickStatusCollapsed\r\n\r\n buildColHeaderHeader = (thead, colHeaderHeaders, rowAttrs, colAttrs, tr, col) ->\r\n colAttr = colAttrs[col]\r\n textContent = colAttr\r\n className = \"pvtAxisLabel\"\r\n setColInitParams col\r\n if col < colAttrs.length-1\r\n className += \" \" + colClassOnInit\r\n textContent = \" \" + colArrowOnInit + \" \" + colAttr if not (isColDisableExpandCollapse or isColDisable or col > colDisableAfter)\r\n th = createElement \"th\", className, textContent\r\n th.setAttribute \"data-colAttr\", colAttr\r\n tr.appendChild th\r\n colHeaderHeaders.push {\r\n tr: tr,\r\n th: th,\r\n clickStatus: colClickStatusOnInit,\r\n expandedCount: 0,\r\n nHeaders: 0}\r\n thead.appendChild tr\r\n\r\n buildColHeaderHeaders = (thead, colHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n if rowAttrs.length != 0\r\n tr.appendChild createElement \"th\", null, null, {\r\n colspan: rowAttrs.length,\r\n rowspan: colAttrs.length}\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, 0\r\n for c in [1..colAttrs.length] when c < colAttrs.length\r\n tr = createElement(\"tr\")\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, c\r\n\r\n buildColHeaderHeadersClickEvents = (colHeaderHeaders, colHeaderCols, colAttrs) ->\r\n n = colAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = colHeaderHeaders[i].th\r\n colAttr = colAttrs[i]\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleColHeaderHeader colHeaderHeaders, colHeaderCols, colAttrs, event.target.getAttribute \"data-colAttr\"\r\n\r\n buildColHeaders = (colHeaderHeaders, colHeaderCols, colHeader, rowAttrs, colAttrs) ->\r\n # DF Recurse\r\n for h in colHeader.children\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs\r\n # Process\r\n #\r\n # NOTE:\r\n # \r\n # We replace colHeader.node with colHeaderCols.length.\r\n # colHeader.node is not useful as columns are positioned depth-first \r\n #\r\n setColInitParams colHeader.col\r\n isColSubtotal = colHeader.children.length != 0\r\n colHeader.node = colHeaderCols.length\r\n hh = colHeaderHeaders[colHeader.col]\r\n ++hh.expandedCount if colHeader.col <= colsCollapseAt\r\n ++hh.nHeaders\r\n tr = hh.tr\r\n th = colHeader.th\r\n addClass th, \"col#{colHeader.row} colcol#{colHeader.col} #{classColShow}\"\r\n colspan = 1\r\n if isColDisable or colHeader.col > colDisableAfter\r\n colspan = colHeader.leaves\r\n else if isColSubtotal and colHeader.col < colsCollapseAt\r\n colspan = 0;\r\n for ch in colHeader.children\r\n colspan += parseInt(ch.th.getAttribute \"colspan\")\r\n colspan += 1 if not isColHideOnExpand\r\n setAttributes th,\r\n \"rowspan\": if colHeader.col == colAttrs.length-1 and rowAttrs.length != 0 then 2 else 1\r\n \"colspan\": colspan, \r\n \"data-colnode\": colHeader.node,\r\n \"data-colHeader\": th.textContent\r\n if isColSubtotal\r\n addClass th, colClassOnInit\r\n th.textContent = \" #{colArrowOnInit} #{th.textContent}\" if not\r\n (isColDisable or colHeader.col > colDisableAfter or isColDisableExpandCollapse)\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleCol colHeaderHeaders, colHeaderCols, parseInt event.target.getAttribute \"data-colnode\"\r\n rowspan = colAttrs.length-(colHeader.col+1) + if rowAttrs.length != 0 then 1 else 0\r\n style = \"pvtColLabel pvtColSubtotal #{colClassOnInit}\"\r\n style += \" col#{colHeader.row} colcol#{colHeader.col}\"\r\n sTh = createElement \"th\", style, '', {\"rowspan\": rowspan, \"data-colnode\": colHeader.node}\r\n addClass sTh, if isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt) then \" #{classColHide}\" else \" #{classColShow}\"\r\n sTh.style.display = \"none\" if isColDisable or colHeader.col > colDisableAfter or colHeader.col > colsCollapseAt\r\n colHeader.children[0].tr.appendChild sTh\r\n colHeader.sTh = sTh\r\n th.style.display = \"none\" if (colHeader.col > colDisableAfter and isColSubtotal) or colHeader.col > colsCollapseAt\r\n colHeader.clickStatus = colClickStatusOnInit\r\n tr.appendChild(th)\r\n colHeader.tr = tr\r\n colHeaderCols.push colHeader\r\n\r\n setRowInitParams = (col) ->\r\n rowArrowOnInit = arrowExpanded\r\n rowClassOnInit = classRowExpanded\r\n rowClickStatusOnInit = clickStatusExpanded\r\n\r\n if col >= rowsCollapseAt and not (isRowDisable or col > rowDisableAfter) \r\n rowArrowOnInit = arrowCollapsed\r\n rowClassOnInit = classRowCollapsed\r\n rowClickStatusOnInit = clickStatusCollapsed\r\n\r\n buildRowHeaderHeaders = (thead, rowHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n rowHeaderHeaders.hh = []\r\n for own i, rowAttr of rowAttrs\r\n textContent = rowAttr\r\n className = \"pvtAxisLabel\"\r\n if i < rowAttrs.length-1\r\n className += \" expanded\"\r\n textContent = \" \" + arrowExpanded + \" \" + rowAttr if not (isRowDisableExpandCollapse or isRowDisable or i > rowDisableAfter)\r\n th = createElement \"th\", className, textContent\r\n th.setAttribute \"data-rowAttr\", rowAttr\r\n tr.appendChild th\r\n rowHeaderHeaders.hh.push \r\n th: th,\r\n clickStatus: clickStatusExpanded,\r\n expandedCount: 0,\r\n nHeaders: 0\r\n if colAttrs.length != 0\r\n th = createElement \"th\"\r\n tr.appendChild th\r\n thead.appendChild tr\r\n rowHeaderHeaders.tr = tr\r\n\r\n buildRowHeaderHeadersClickEvents = (rowHeaderHeaders, rowHeaderRows, rowAttrs) ->\r\n n = rowAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = rowHeaderHeaders.hh[i]\r\n rowAttr = rowAttrs[i]\r\n th.th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRowHeaderHeader rowHeaderHeaders, rowHeaderRows, rowAttrs, event.target.getAttribute \"data-rowAttr\"\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n rowspan = 1\r\n if colAttrs.length != 0\r\n rowspan = colAttrs.length + (if rowAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals, {rowspan: rowspan}\r\n tr.appendChild th\r\n\r\n buildRowHeaders = (tbody, rowHeaderHeaders, rowHeaderRows, rowHeader, rowAttrs, colAttrs) ->\r\n # DF Recurse\r\n for h in rowHeader.children\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs\r\n # Process\r\n #\r\n # NOTE:\r\n # \r\n # We replace rowHeader.node with rowHeaderCols.length.\r\n # rowHeader.node is not useful as columns are positioned depth-first \r\n #\r\n setRowInitParams rowHeader.col\r\n isRowSubtotal = rowHeader.children.length != 0\r\n rowHeader.node = rowHeaderRows.length\r\n hh = rowHeaderHeaders.hh[rowHeader.col]\r\n ++hh.expandedCount if rowHeader.col <= rowsCollapseAt\r\n ++hh.nHeaders\r\n\r\n tr = createElement \"tr\", \"pvtRowSubtotal row#{rowHeader.row}\", \"\", \"data-rownode\": rowHeader.node \r\n th = rowHeader.th\r\n isRowSubtotal = rowHeader.children.length != 0;\r\n addClass th, \"row#{rowHeader.row} rowcol#{rowHeader.col} #{classRowShow}\"\r\n rowspan = 1\r\n if isRowDisable or rowHeader.col > rowDisableAfter\r\n rowspan = rowHeader.leaves\r\n else if isRowSubtotal and rowHeader.col < rowsCollapseAt\r\n rowspan = 0;\r\n for ch in rowHeader.children\r\n rowspan += parseInt(ch.th.getAttribute \"rowspan\")\r\n rowspan += 2 if not isRowHideOnExpand\r\n setAttributes th,\r\n \"rowspan\": rowspan\r\n \"colspan\": if rowHeader.col == rowAttrs.length-1 and colAttrs.length != 0 then 2 else 1\r\n \"data-rownode\": rowHeader.node,\r\n \"data-rowHeader\": th.textContent\r\n th.style.display = \"none\" if rowHeader.col > rowsCollapseAt\r\n tr.appendChild(th)\r\n if isRowSubtotal\r\n tbody.insertBefore tr, rowHeader.children[0].tr\r\n else\r\n tbody.appendChild tr\r\n rowHeader.tr = tr\r\n \r\n if isRowSubtotal\r\n addClass th, rowClassOnInit\r\n addClass tr, rowClassOnInit\r\n th.textContent = \" #{rowArrowOnInit} #{th.textContent}\" if not\r\n (isRowDisable or rowHeader.col > rowDisableAfter or isRowDisableExpandCollapse)\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRow rowHeaderHeaders, rowHeaderRows, parseInt event.target.getAttribute \"data-rownode\"\r\n th.style.display = \"none\" if isRowDisable or rowHeader.col > rowDisableAfter or rowHeader.col > rowsCollapseAt\r\n # Filler\r\n colspan = rowAttrs.length-(rowHeader.col+1) + if colAttrs.length != 0 then 1 else 0\r\n style = \"pvtRowLabel pvtRowSubtotal #{rowClassOnInit}\"\r\n style += \" row#{rowHeader.row} rowcol#{rowHeader.col}\"\r\n th = createElement \"th\", style, '', {\"colspan\": colspan, \"data-rownode\": rowHeader.node}\r\n addClass th, if isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt) then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n th.style.display = \"none\"\r\n tr.appendChild th\r\n\r\n tr = createElement \"tr\", \"pvtRowSubtotal row#{rowHeader.row}\", \"\", \"data-rownode\": rowHeader.node \r\n th = th.cloneNode()\r\n th.style.display = if isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt) then \"none\" else \"\"\r\n tr.appendChild(th)\r\n tbody.appendChild tr\r\n rowHeader.sTr = tr\r\n\r\n rowHeader.clickStatus = rowClickStatusOnInit\r\n rowHeaderRows.push rowHeader\r\n\r\n\r\n buildValues = (rowHeaderRows, colHeaderCols) ->\r\n for rowHeader in rowHeaderRows\r\n setRowInitParams rowHeader.col\r\n flatRowKey = rowHeader.flatKey\r\n isRowSubtotal = rowHeader.children.length != 0;\r\n tr = if isRowSubtotal then rowHeader.sTr else rowHeader.tr\r\n for colHeader in colHeaderCols\r\n flatColKey = colHeader.flatKey\r\n aggregator = tree[flatRowKey][flatColKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n isColSubtotal = colHeader.children.length != 0;\r\n setColInitParams colHeader.col\r\n style = \"pvtVal\"\r\n style += \" pvtColSubtotal #{colClassOnInit}\" if isColSubtotal\r\n style += \" pvtRowSubtotal #{rowClassOnInit}\" if isRowSubtotal\r\n style += if isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt)) then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n style += if isColSubtotal and (isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt)) then \" #{classColHide}\" else \" #{classColShow}\"\r\n style += \" row#{rowHeader.row}\" +\r\n \" col#{colHeader.row}\" +\r\n \" rowcol#{rowHeader.col}\" +\r\n \" colcol#{colHeader.col}\"\r\n eventHandlers = getTableEventHandlers val, rowHeader.key, colHeader.key\r\n td = createElement \"td\", style, aggregator.format(val),\r\n \"data-value\": val,\r\n \"data-rownode\": rowHeader.node,\r\n \"data-colnode\": colHeader.node, eventHandlers\r\n td.style.display = \"none\" if (isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt))) or (isColSubtotal and (isColDisable or colHeader.col > colDisableAfter or colHeader.col > colsCollapseAt))\r\n \r\n tr.appendChild td\r\n # buildRowTotal\r\n totalAggregator = rowTotals[flatRowKey]\r\n val = totalAggregator.value()\r\n style = \"pvtTotal rowTotal\"\r\n style += \" pvtRowSubtotal\" if isRowSubtotal \r\n style += if isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCllapseAt)) then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n style += \" row#{rowHeader.row} rowcol#{rowHeader.col}\"\r\n td = createElement \"td\", style, totalAggregator.format(val),\r\n \"data-value\": val,\r\n \"data-row\": \"row#{rowHeader.row}\",\r\n \"data-rowcol\": \"col#{rowHeader.col}\",\r\n \"data-rownode\": rowHeader.node, getTableEventHandlers val, rowHeader.key, []\r\n td.style.display = \"none\" if isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCllapseAt))\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, colHeaderCols) ->\r\n for h in colHeaderCols\r\n isColSubtotal = h.children.length != 0\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n setColInitParams h.col\r\n style = \"pvtVal pvtTotal colTotal\"\r\n style += \" pvtColSubtotal\" if isColSubtotal\r\n style += \" #{colClassOnInit}\"\r\n style += \" col#{h.row} colcol#{h.col}\"\r\n td = createElement \"td\", style, totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-for\": \"col#{h.col}\"\r\n \"data-colnode\": \"#{h.node}\", getTableEventHandlers val, [], h.key\r\n td.style.display = \"none\" if isColSubtotal and (isColDisable or h.col > colDisableAfter or (isColHideOnExpand and h.col < colsCllapseAt))\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (result, tr) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], []\r\n tr.appendChild td\r\n result.appendChild tr\r\n\r\n\r\n hideDescendantCol = (d) ->\r\n $(d.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{d.node}\\\"], th[data-colnode=\\\"#{d.node}\\\"]\" \r\n .removeClass classColShow \r\n .addClass classColHide \r\n .css 'display', \"none\" \r\n\r\n collapseShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColExpanded} #{classColHide}\"\r\n .addClass \"#{classColCollapsed} #{classColShow}\"\r\n .not \".pvtRowSubtotal.#{classRowHide}\"\r\n .css 'display', \"\" \r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-colheader\"\r\n h.th.colSpan = 1\r\n\r\n collapseCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if isColDisable\r\n return if isColDisableExpandCollapse\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.col > colDisableAfter\r\n return if h.clickStatus is clickStatusCollapsed\r\n\r\n isColSubtotal = h.descendants != 0\r\n colspan = h.th.colSpan \r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = colHeaderCols[c-i]\r\n hideDescendantCol d\r\n if isColSubtotal \r\n collapseShowColSubtotal h\r\n --colspan\r\n p = h.parent\r\n while p isnt null\r\n p.th.colSpan -= colspan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n colHeaderHeader = colHeaderHeaders[h.col]\r\n colHeaderHeader.expandedCount--\r\n if colHeaderHeader.expandedCount == 0\r\n for i in [h.col..colHeaderHeaders.length-2] when i <= colDisableAfter\r\n colHeaderHeader = colHeaderHeaders[i]\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colHeaderHeader.th.getAttribute \"data-colAttr\"\r\n colHeaderHeader.clickStatus = clickStatusCollapsed\r\n\r\n showChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColHide\r\n .addClass classColShow\r\n .not \".pvtRowSubtotal.#{classRowHide}\"\r\n .css 'display', \"\" \r\n\r\n expandHideColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColShow}\" \r\n .addClass \"#{classColExpanded} #{classColHide}\" \r\n .css 'display', \"none\" \r\n h.th.style.display = \"\"\r\n\r\n expandShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColHide}\"\r\n .addClass \"#{classColExpanded} #{classColShow}\"\r\n .not \".pvtRowSubtotal.#{classRowHide}\"\r\n .css 'display', \"\" \r\n h.th.style.display = \"\"\r\n ++h.th.colSpan\r\n h.sTh.style.display = \"\" if h.sTh?\r\n\r\n expandChildCol = (ch) ->\r\n if ch.descendants != 0 and hasClass(ch.th, classColExpanded) and (isColDisable or ch.col > colDisableAfter or isColHideOnExpand)\r\n ch.th.style.display = \"\"\r\n else\r\n showChildCol ch\r\n expandChildCol gch for gch in ch.children if ch.clickStatus isnt clickStatusCollapsed\r\n\r\n expandCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if isColDisable\r\n return if isColDisableExpandCollapse\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.col > colDisableAfter\r\n return if h.clickStatus is clickStatusExpanded\r\n\r\n isColSubtotal = h.descendants != 0\r\n colspan = 0\r\n for ch in h.children\r\n expandChildCol ch\r\n colspan += ch.th.colSpan\r\n h.th.colSpan = colspan\r\n if isColSubtotal\r\n replaceClass h.th, classColCollapsed, classColExpanded\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-colHeader\"\r\n if isColHideOnExpand\r\n expandHideColSubtotal h\r\n --colspan\r\n else\r\n expandShowColSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.colSpan += colspan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n hh = colHeaderHeaders[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount is hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-colAttr\"\r\n hh.clickStatus = clickStatusExpanded\r\n\r\n collapseHideDescendantRow = (h) ->\r\n h.tr.style.display = \"none\"\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n replaceClass cell, classRowShow, classRowHide\r\n cell.style.display = \"none\"\r\n\r\n collapseShowRowSubtotal = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n cell.style.display = \"\" if not hasClass cell, classColHide\r\n h.th.rowSpan = 1\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n replaceClass h.tr, classRowExpanded, classRowCollapsed\r\n\r\n collapseRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if isRowDisable\r\n return if isRowDisableExpandCollapse\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.col > rowDisableAfter\r\n return if h.clickStatus is clickStatusCollapsed\r\n\r\n isRowSubtotal = h.descendants != 0\r\n rowspan = h.th.rowSpan \r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = rowHeaderRows[r+i]\r\n collapseHideDescendantRow d\r\n if isRowSubtotal\r\n collapseShowRowSubtotal h\r\n --rowspan\r\n p = h.parent\r\n while p\r\n p.th.rowSpan -= rowspan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n\r\n hh = rowHeaderHeaders.hh[h.col]\r\n hh.expandedCount--\r\n\r\n return if hh.expandedCount != 0\r\n\r\n for j in [h.col..rowHeaderHeaders.hh.length-2] when j <= rowDisableAfter\r\n hh = rowHeaderHeaders.hh[j]\r\n replaceClass hh.th, classExpanded, classCollapsed\r\n hh.th.textContent = \" \" + arrowCollapsed + \" \" + hh.th.getAttribute \"data-rowAttr\"\r\n hh.clickStatus = clickStatusCollapsed\r\n\r\n showChildRow = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n replaceClass cell, classRowHide, classRowShow\r\n cell.style.display = \"\" if not hasClass cell, classColHide\r\n h.tr.style.display = \"\"\r\n\r\n expandShowRowSubtotal = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\" \r\n cell.style.display = \"\" if not hasClass cell, classColHide\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n replaceClass h.tr, classRowCollapsed, classRowExpanded\r\n\r\n expandHideRowSubtotal = (h) ->\r\n for tagName in [\"td\", \"th\"]\r\n cells = h.tr.getElementsByTagName tagName \r\n for cell in cells\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n cell.style.display = \"none\"\r\n h.th.style.display = \"\"\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n replaceClass h.tr, classRowCollapsed, classRowExpanded\r\n\r\n expandChildRow = (ch) ->\r\n if ch.descendants != 0 and hasClass(ch.th, classRowExpanded) and (isRowHideOnExpand or isRowDisable or ch.col > rowDisableAfter)\r\n ch.tr.style.display = \"\"\r\n ch.th.style.display = \"\"\r\n else\r\n showChildRow ch\r\n expandChildRow gch for gch in ch.children if ch.clickStatus isnt clickStatusCollapsed\r\n\r\n expandRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if isRowDisable\r\n return if isRowDisableExpandCollapse\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.col > rowDisableAfter\r\n return if h.clickStatus is clickStatusExpanded\r\n\r\n isRowSubtotal = h.descendants != 0\r\n rowspan = 0\r\n for ch in h.children\r\n expandChildRow ch\r\n rowspan += ch.th.rowSpan\r\n h.th.rowSpan = rowspan+1\r\n if isRowSubtotal\r\n if isRowHideOnExpand\r\n expandHideRowSubtotal h\r\n else\r\n expandShowRowSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.rowSpan += rowspan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n hh = rowHeaderHeaders.hh[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount == hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-rowAttr\"\r\n hh.clickStatus = clickStatusExpanded\r\n\r\n toggleCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]?\r\n\r\n h = colHeaderCols[c]\r\n if h.clickStatus is clickStatusCollapsed\r\n expandCol(colHeaderHeaders, colHeaderCols, c)\r\n else\r\n collapseCol(colHeaderHeaders, colHeaderCols, c)\r\n h.th.scrollIntoView\r\n\r\n toggleRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]?\r\n\r\n if rowHeaderRows[r].clickStatus is clickStatusCollapsed\r\n expandRow(rowHeaderHeaders, rowHeaderRows, r)\r\n else\r\n collapseRow(rowHeaderHeaders, rowHeaderRows, r)\r\n\r\n collapseColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n return if isColDisable\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n i = idx\r\n nAttrs = colAttrs.length-1\r\n while i < nAttrs and i <= colDisableAfter\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classExpanded, classCollapsed\r\n hh.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[i]\r\n hh.clickStatus = clickStatusCollapsed\r\n ++i\r\n i = 0\r\n nCols = colHeaderCols.length\r\n while i < nCols\r\n h = colHeaderCols[i]\r\n if h.col is idx and h.clickStatus isnt clickStatusCollapsed and h.th.style.display isnt \"none\"\r\n collapseCol colHeaderHeaders, colHeaderCols, parseInt h.th.getAttribute(\"data-colnode\")\r\n ++i\r\n\r\n expandColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n return if isColDisable\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n for i in [0..idx]\r\n if i <= colDisableAfter\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[i]\r\n hh.clickStatus = clickStatusExpanded\r\n j = 0\r\n nCols = colHeaderCols.length\r\n while j < nCols\r\n h = colHeaderCols[j]\r\n expandCol colHeaderHeaders, colHeaderCols, j if h.col == i\r\n ++j\r\n ++idx\r\n while idx < colAttrs.length-1 and idx <= colDisableAfter\r\n colHeaderHeader = colHeaderHeaders[idx]\r\n if colHeaderHeader.expandedCount == 0\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = clickStatusCollapsed\r\n else if colHeaderHeader.expandedCount == colHeaderHeader.nHeaders\r\n replaceClass colHeaderHeader.th, classCollapsed, classExpanded\r\n colHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = clickStatusExpanded\r\n ++idx\r\n\r\n collapseRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n return if isRowDisable\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n i = idx\r\n nAttrs = rowAttrs.length-1\r\n while i < nAttrs and i <= rowDisableAfter\r\n h = rowHeaderHeaders.hh[i]\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[i]\r\n h.clickStatus = clickStatusCollapsed\r\n ++i\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col is idx and h.clickStatus isnt clickStatusCollapsed and h.tr.style.display isnt \"none\"\r\n collapseRow rowHeaderHeaders, rowHeaderRows, j\r\n j = j + h.descendants + 1\r\n else\r\n ++j\r\n\r\n expandRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n return if isRowDisable\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n for i in [0..idx]\r\n if i <= rowDisableAfter\r\n hh = rowHeaderHeaders.hh[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[i]\r\n hh.clickStatus = clickStatusExpanded\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col == i\r\n expandRow(rowHeaderHeaders, rowHeaderRows, j)\r\n j += h.descendants + 1\r\n else\r\n ++j\r\n ++idx\r\n while idx < rowAttrs.length-1 and idx <= rowDisableAfter\r\n rowHeaderHeader = rowHeaderHeaders.hh[idx]\r\n if rowHeaderHeader.expandedCount == 0\r\n replaceClass rowHeaderHeader.th, classExpanded, classCollapsed\r\n rowHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = clickStatusCollapsed\r\n else if rowHeaderHeader.expandedCount == rowHeaderHeader.nHeaders\r\n replaceClass rowHeaderHeader.th, classCollapsed, classExpanded\r\n rowHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = clickStatusExpanded\r\n ++idx\r\n\r\n toggleColHeaderHeader = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n return if isColDisable\r\n return if isColDisableExpandCollapse\r\n\r\n idx = colAttrs.indexOf colAttr\r\n h = colHeaderHeaders[idx]\r\n return if h.col > colDisableAfter\r\n if h.clickStatus is clickStatusCollapsed\r\n expandColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n else\r\n collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n\r\n\r\n toggleRowHeaderHeader = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n return if isRowDisable\r\n return if isRowDisableExpandCollapse\r\n\r\n idx = rowAttrs.indexOf rowAttr\r\n th = rowHeaderHeaders.hh[idx]\r\n return if th.col > rowDisableAfter\r\n if th.clickStatus is clickStatusCollapsed\r\n expandRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n else\r\n collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowHeaders = []\r\n colHeaders = []\r\n rowHeaderHeaders = {}\r\n rowHeaderRows = []\r\n colHeaderHeaders = []\r\n colHeaderCols = []\r\n\r\n rowHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length > 0 and rowKeys.length > 0\r\n colHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length > 0 and colKeys.length > 0\r\n\r\n result = createElement \"table\", \"pvtTable\", null, {style: \"display: none;\"}\r\n\r\n thead = createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length > 0\r\n buildColHeaderHeaders thead, colHeaderHeaders, rowAttrs, colAttrs\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs for h in colHeaders\r\n buildColHeaderHeadersClickEvents colHeaderHeaders, colHeaderCols, colAttrs\r\n\r\n if rowAttrs.length > 0\r\n buildRowHeaderHeaders thead, rowHeaderHeaders, rowAttrs, colAttrs\r\n buildRowTotalsHeader rowHeaderHeaders.tr, rowAttrs, colAttrs if colAttrs.length == 0\r\n\r\n if colAttrs.length > 0\r\n buildRowTotalsHeader colHeaderHeaders[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = createElement \"tbody\"\r\n result.appendChild tbody\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs for h in rowHeaders if rowAttrs.length > 0\r\n buildRowHeaderHeadersClickEvents rowHeaderHeaders, rowHeaderRows, rowAttrs\r\n buildValues rowHeaderRows, colHeaderCols\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colHeaderCols if colAttrs.length > 0\r\n buildGrandTotal tbody, tr\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\r\n # result.style.display = \"\" if not opts.collapseRowsAt? and not opts.collapseColsAt?\r\n # collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, opts.collapseRowsAt if opts.collapseRowsAt?\r\n # if not opts.collapseColsAt?\r\n # result.style.display = \"\"\r\n # return result\r\n # collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, opts.collapseColsAt if opts.collapseColsAt?\r\n result.style.display = \"\"\r\n\r\n return result\r\n\r\n return main rowAttrs, rowKeys, colAttrs, colKeys\r\n\r\n $.pivotUtilities.subtotal_renderers =\r\n \"Table With Subtotal\": (pvtData, opts) -> SubtotalRenderer pvtData, opts\r\n \"Table With Subtotal Bar Chart\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).barchart()\r\n \"Table With Subtotal Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"heatmap\", opts\r\n \"Table With Subtotal Row Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"rowheatmap\", opts\r\n \"Table With Subtotal Col Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"colheatmap\", opts\r\n\r\n #\r\n # \r\n # Aggregators\r\n # \r\n #\r\n\r\n usFmtPct = $.pivotUtilities.numberFormat digitsAfterDecimal:1, scaler: 100, suffix: \"%\"\r\n aggregatorTemplates = $.pivotUtilities.aggregatorTemplates;\r\n\r\n subtotalAggregatorTemplates =\r\n fractionOf: (wrapped, type=\"row\", formatter=usFmtPct) -> (x...) -> (data, rowKey, colKey) ->\r\n rowKey = [] if typeof rowKey is \"undefined\"\r\n colKey = [] if typeof colKey is \"undefined\"\r\n selector: {row: [rowKey.slice(0, -1),[]], col: [[], colKey.slice(0, -1)]}[type]\r\n inner: wrapped(x...)(data, rowKey, colKey)\r\n push: (record) -> @inner.push record\r\n format: formatter\r\n value: -> @inner.value() / data.getAggregator(@selector...).inner.value()\r\n numInputs: wrapped(x...)().numInputs\r\n\r\n $.pivotUtilities.subtotalAggregatorTemplates = subtotalAggregatorTemplates\r\n\r\n $.pivotUtilities.subtotal_aggregators = do (tpl = aggregatorTemplates, sTpl = subtotalAggregatorTemplates) ->\r\n \"Sum As Fraction Of Parent Row\": sTpl.fractionOf(tpl.sum(), \"row\", usFmtPct)\r\n \"Sum As Fraction Of Parent Column\": sTpl.fractionOf(tpl.sum(), \"col\", usFmtPct)\r\n \"Count As Fraction Of Parent Row\": sTpl.fractionOf(tpl.count(), \"row\", usFmtPct)\r\n \"Count As Fraction Of Parent Column\": sTpl.fractionOf(tpl.count(), \"col\", usFmtPct)\r\n\r\n"]}
\ No newline at end of file
diff --git a/examples/105_default.html b/examples/105_default.html
index dfa0645..559aa09 100644
--- a/examples/105_default.html
+++ b/examples/105_default.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/110_collapse_rowscols.html b/examples/110_collapse_rowscols.html
index 48ab670..d152885 100644
--- a/examples/110_collapse_rowscols.html
+++ b/examples/110_collapse_rowscols.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/137_as_fraction_of_parent_row.html b/examples/137_as_fraction_of_parent_row.html
index 2d6dace..e671a92 100644
--- a/examples/137_as_fraction_of_parent_row.html
+++ b/examples/137_as_fraction_of_parent_row.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/139_as_fraction_of_parent_column.html b/examples/139_as_fraction_of_parent_column.html
index e5c592c..7dcc039 100644
--- a/examples/139_as_fraction_of_parent_column.html
+++ b/examples/139_as_fraction_of_parent_column.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/155_custom_collapse_expand_arrow.html b/examples/155_custom_collapse_expand_arrow.html
index 3aff7b8..34d240a 100644
--- a/examples/155_custom_collapse_expand_arrow.html
+++ b/examples/155_custom_collapse_expand_arrow.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/160_event_handlers.html b/examples/160_event_handlers.html
index da0ab57..d84de07 100644
--- a/examples/160_event_handlers.html
+++ b/examples/160_event_handlers.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/170_hide_subtotal_on_expand.html b/examples/170_hide_subtotal_on_expand.html
index 52bb47b..b06da69 100644
--- a/examples/170_hide_subtotal_on_expand.html
+++ b/examples/170_hide_subtotal_on_expand.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/180_disable_subtotal.html b/examples/180_disable_subtotal.html
index 771aaf4..f948588 100644
--- a/examples/180_disable_subtotal.html
+++ b/examples/180_disable_subtotal.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/185_disable_expandcollapse.html b/examples/185_disable_expandcollapse.html
index cc5daeb..debeb96 100644
--- a/examples/185_disable_expandcollapse.html
+++ b/examples/185_disable_expandcollapse.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/190_disable_after.html b/examples/190_disable_after.html
index bd7de54..98178c4 100644
--- a/examples/190_disable_after.html
+++ b/examples/190_disable_after.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/205_default.html b/examples/205_default.html
index cd3cb0b..96e67e7 100644
--- a/examples/205_default.html
+++ b/examples/205_default.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/210_collapse_rowscols.html b/examples/210_collapse_rowscols.html
index edae257..c98baeb 100644
--- a/examples/210_collapse_rowscols.html
+++ b/examples/210_collapse_rowscols.html
@@ -7,8 +7,8 @@
-
-
+
+
@@ -45,11 +45,11 @@
},
rendererName: "Table With Subtotal",
rendererOptions: {
- collapseRowsAt: 0,
+ // collapseRowsAt: 0,
collapseColsAt: 1,
colSubtotalDisplay: {
hideOnExpand: true,
- disableAfter: 1
+ // disableAfter: 1
}
}
});
diff --git a/examples/237_as_fraction_of_parent_row.html b/examples/237_as_fraction_of_parent_row.html
index f80df0a..ee084d2 100644
--- a/examples/237_as_fraction_of_parent_row.html
+++ b/examples/237_as_fraction_of_parent_row.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/239_as_fraction_of_parent_column.html b/examples/239_as_fraction_of_parent_column.html
index d7646cd..2f43fff 100644
--- a/examples/239_as_fraction_of_parent_column.html
+++ b/examples/239_as_fraction_of_parent_column.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/255_custom_collapse_expand_arrow.html b/examples/255_custom_collapse_expand_arrow.html
index d8e5426..f17abb2 100644
--- a/examples/255_custom_collapse_expand_arrow.html
+++ b/examples/255_custom_collapse_expand_arrow.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/260_event_handlers.html b/examples/260_event_handlers.html
index 300fdcb..778638a 100644
--- a/examples/260_event_handlers.html
+++ b/examples/260_event_handlers.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/270_hide_subtotal_on_expand.html b/examples/270_hide_subtotal_on_expand.html
index 2d249e4..6770f5e 100644
--- a/examples/270_hide_subtotal_on_expand.html
+++ b/examples/270_hide_subtotal_on_expand.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/280_disable_subtotal.html b/examples/280_disable_subtotal.html
index 34c714b..ae968bd 100644
--- a/examples/280_disable_subtotal.html
+++ b/examples/280_disable_subtotal.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/285_disable_expandcollapse.html b/examples/285_disable_expandcollapse.html
index 5b34c88..ba45fe7 100644
--- a/examples/285_disable_expandcollapse.html
+++ b/examples/285_disable_expandcollapse.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/examples/290_disable_after.html b/examples/290_disable_after.html
index 870399b..89d9a1e 100644
--- a/examples/290_disable_after.html
+++ b/examples/290_disable_after.html
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/subtotal.coffee b/subtotal.coffee
index 8aedff4..a110f2d 100644
--- a/subtotal.coffee
+++ b/subtotal.coffee
@@ -96,6 +96,10 @@ callWithJQuery ($) ->
colClassOnInit = classColExpanded
colClickStatusOnInit = clickStatusExpanded
+ rowArrowOnInit = arrowExpanded
+ rowClassOnInit = classRowExpanded
+ rowClickStatusOnInit = clickStatusExpanded
+
# Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- Begin
hasClass = (element, className) ->
regExp = new RegExp "(?:^|\\s)" + className + "(?!\\S)", "g"
@@ -314,10 +318,9 @@ callWithJQuery ($) ->
rowspan = colAttrs.length-(colHeader.col+1) + if rowAttrs.length != 0 then 1 else 0
style = "pvtColLabel pvtColSubtotal #{colClassOnInit}"
style += " col#{colHeader.row} colcol#{colHeader.col}"
- # style += " #{classColHide}" if isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt)
sTh = createElement "th", style, '', {"rowspan": rowspan, "data-colnode": colHeader.node}
addClass sTh, if isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt) then " #{classColHide}" else " #{classColShow}"
- sTh.style.display = "none" if isColDisable or colHeader.col > colDisableAfter or colHeader.col != colsCollapseAt
+ sTh.style.display = "none" if isColDisable or colHeader.col > colDisableAfter or colHeader.col > colsCollapseAt
colHeader.children[0].tr.appendChild sTh
colHeader.sTh = sTh
th.style.display = "none" if (colHeader.col > colDisableAfter and isColSubtotal) or colHeader.col > colsCollapseAt
@@ -326,6 +329,16 @@ callWithJQuery ($) ->
colHeader.tr = tr
colHeaderCols.push colHeader
+ setRowInitParams = (col) ->
+ rowArrowOnInit = arrowExpanded
+ rowClassOnInit = classRowExpanded
+ rowClickStatusOnInit = clickStatusExpanded
+
+ if col >= rowsCollapseAt and not (isRowDisable or col > rowDisableAfter)
+ rowArrowOnInit = arrowCollapsed
+ rowClassOnInit = classRowCollapsed
+ rowClickStatusOnInit = clickStatusCollapsed
+
buildRowHeaderHeaders = (thead, rowHeaderHeaders, rowAttrs, colAttrs) ->
tr = createElement "tr"
rowHeaderHeaders.hh = []
@@ -366,46 +379,83 @@ callWithJQuery ($) ->
tr.appendChild th
buildRowHeaders = (tbody, rowHeaderHeaders, rowHeaderRows, rowHeader, rowAttrs, colAttrs) ->
+ # DF Recurse
+ for h in rowHeader.children
+ buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs
+ # Process
+ #
+ # NOTE:
+ #
+ # We replace rowHeader.node with rowHeaderCols.length.
+ # rowHeader.node is not useful as columns are positioned depth-first
+ #
+ setRowInitParams rowHeader.col
+ isRowSubtotal = rowHeader.children.length != 0
+ rowHeader.node = rowHeaderRows.length
hh = rowHeaderHeaders.hh[rowHeader.col]
- ++hh.expandedCount
+ ++hh.expandedCount if rowHeader.col <= rowsCollapseAt
++hh.nHeaders
+
tr = createElement "tr", "pvtRowSubtotal row#{rowHeader.row}", "", "data-rownode": rowHeader.node
th = rowHeader.th
isRowSubtotal = rowHeader.children.length != 0;
addClass th, "row#{rowHeader.row} rowcol#{rowHeader.col} #{classRowShow}"
+ rowspan = 1
+ if isRowDisable or rowHeader.col > rowDisableAfter
+ rowspan = rowHeader.leaves
+ else if isRowSubtotal and rowHeader.col < rowsCollapseAt
+ rowspan = 0;
+ for ch in rowHeader.children
+ rowspan += parseInt(ch.th.getAttribute "rowspan")
+ rowspan += 2 if not isRowHideOnExpand
setAttributes th,
- "data-rowHeader": th.textContent,
- "data-rownode": rowHeader.node,
- "rowspan": rowHeader.descendants+1,
+ "rowspan": rowspan
"colspan": if rowHeader.col == rowAttrs.length-1 and colAttrs.length != 0 then 2 else 1
- tr.appendChild th
+ "data-rownode": rowHeader.node,
+ "data-rowHeader": th.textContent
+ th.style.display = "none" if rowHeader.col > rowsCollapseAt
+ tr.appendChild(th)
+ if isRowSubtotal
+ tbody.insertBefore tr, rowHeader.children[0].tr
+ else
+ tbody.appendChild tr
+ rowHeader.tr = tr
+
if isRowSubtotal
- addClass tr, classRowExpanded
- addClass th, classRowExpanded
- th.textContent = " " + arrowExpanded + " " + th.textContent if not (isRowDisableExpandCollapse or isRowDisable or rowHeader.col > rowDisableAfter)
+ addClass th, rowClassOnInit
+ addClass tr, rowClassOnInit
+ th.textContent = " #{rowArrowOnInit} #{th.textContent}" if not
+ (isRowDisable or rowHeader.col > rowDisableAfter or isRowDisableExpandCollapse)
th.onclick = (event) ->
event = event || window.event
toggleRow rowHeaderHeaders, rowHeaderRows, parseInt event.target.getAttribute "data-rownode"
- # Filler th
+ th.style.display = "none" if isRowDisable or rowHeader.col > rowDisableAfter or rowHeader.col > rowsCollapseAt
+ # Filler
colspan = rowAttrs.length-(rowHeader.col+1) + if colAttrs.length != 0 then 1 else 0
- style = "pvtRowLabel pvtRowSubtotal #{classRowExpanded}"
+ style = "pvtRowLabel pvtRowSubtotal #{rowClassOnInit}"
style += " row#{rowHeader.row} rowcol#{rowHeader.col}"
- style += if isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter then " #{classRowHide}" else " #{classRowShow}"
th = createElement "th", style, '', {"colspan": colspan, "data-rownode": rowHeader.node}
- th.style.display = "none" if isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter
+ addClass th, if isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt) then " #{classRowHide}" else " #{classRowShow}"
+ th.style.display = "none"
tr.appendChild th
- rowHeader.clickStatus = clickStatusExpanded
- rowHeader.tr = tr
+
+ tr = createElement "tr", "pvtRowSubtotal row#{rowHeader.row}", "", "data-rownode": rowHeader.node
+ th = th.cloneNode()
+ th.style.display = if isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt) then "none" else ""
+ tr.appendChild(th)
+ tbody.appendChild tr
+ rowHeader.sTr = tr
+
+ rowHeader.clickStatus = rowClickStatusOnInit
rowHeaderRows.push rowHeader
- tbody.appendChild tr
- for h in rowHeader.children
- buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs
+
buildValues = (rowHeaderRows, colHeaderCols) ->
for rowHeader in rowHeaderRows
- tr = rowHeader.tr
+ setRowInitParams rowHeader.col
flatRowKey = rowHeader.flatKey
isRowSubtotal = rowHeader.children.length != 0;
+ tr = if isRowSubtotal then rowHeader.sTr else rowHeader.tr
for colHeader in colHeaderCols
flatColKey = colHeader.flatKey
aggregator = tree[flatRowKey][flatColKey] ? {value: (-> null), format: -> ""}
@@ -414,8 +464,8 @@ callWithJQuery ($) ->
setColInitParams colHeader.col
style = "pvtVal"
style += " pvtColSubtotal #{colClassOnInit}" if isColSubtotal
- style += " pvtRowSubtotal #{classRowExpanded}" if isRowSubtotal
- style += if isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter) then " #{classRowHide}" else " #{classRowShow}"
+ style += " pvtRowSubtotal #{rowClassOnInit}" if isRowSubtotal
+ style += if isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt)) then " #{classRowHide}" else " #{classRowShow}"
style += if isColSubtotal and (isColDisable or colHeader.col > colDisableAfter or (isColHideOnExpand and colHeader.col < colsCollapseAt)) then " #{classColHide}" else " #{classColShow}"
style += " row#{rowHeader.row}" +
" col#{colHeader.row}" +
@@ -426,22 +476,22 @@ callWithJQuery ($) ->
"data-value": val,
"data-rownode": rowHeader.node,
"data-colnode": colHeader.node, eventHandlers
- td.style.display = "none" if (isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter)) or isColDisable or colHeader.col > colDisableAfter or colHeader.col != colsCollapseAt
- # or (colHeader.col > colsCollapseAt)
+ td.style.display = "none" if (isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCollapseAt))) or (isColSubtotal and (isColDisable or colHeader.col > colDisableAfter or colHeader.col > colsCollapseAt))
+
tr.appendChild td
# buildRowTotal
totalAggregator = rowTotals[flatRowKey]
val = totalAggregator.value()
style = "pvtTotal rowTotal"
style += " pvtRowSubtotal" if isRowSubtotal
- style += if isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter) then " #{classRowHide}" else " #{classRowShow}"
+ style += if isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCllapseAt)) then " #{classRowHide}" else " #{classRowShow}"
style += " row#{rowHeader.row} rowcol#{rowHeader.col}"
td = createElement "td", style, totalAggregator.format(val),
"data-value": val,
"data-row": "row#{rowHeader.row}",
"data-rowcol": "col#{rowHeader.col}",
"data-rownode": rowHeader.node, getTableEventHandlers val, rowHeader.key, []
- td.style.display = "none" if isRowSubtotal and (isRowHideOnExpand or isRowDisable or rowHeader.col > rowDisableAfter)
+ td.style.display = "none" if isRowSubtotal and (isRowDisable or rowHeader.col > rowDisableAfter or (isRowHideOnExpand and rowHeader.col < rowsCllapseAt))
tr.appendChild td
buildColTotalsHeader = (rowAttrs, colAttrs) ->
@@ -459,14 +509,13 @@ callWithJQuery ($) ->
setColInitParams h.col
style = "pvtVal pvtTotal colTotal"
style += " pvtColSubtotal" if isColSubtotal
- style += " #{classColExpanded}"
+ style += " #{colClassOnInit}"
style += " col#{h.row} colcol#{h.col}"
td = createElement "td", style, totalAggregator.format(val),
"data-value": val
"data-for": "col#{h.col}"
"data-colnode": "#{h.node}", getTableEventHandlers val, [], h.key
- td.style.display = "none" if isColDisable or h.col > colDisableAfter or h.col != colsCollapseAt
- # or (h.col > colsCollapseAt)
+ td.style.display = "none" if isColSubtotal and (isColDisable or h.col > colDisableAfter or (isColHideOnExpand and h.col < colsCllapseAt))
tr.appendChild td
buildGrandTotal = (result, tr) ->