diff --git a/inst/htmlwidgets/lib/datatables-extensions/Buttons/js/buttons.html5.min.js b/inst/htmlwidgets/lib/datatables-extensions/Buttons/js/buttons.html5.min.js
index 222bb320..908d85d3 100644
--- a/inst/htmlwidgets/lib/datatables-extensions/Buttons/js/buttons.html5.min.js
+++ b/inst/htmlwidgets/lib/datatables-extensions/Buttons/js/buttons.html5.min.js
@@ -436,10 +436,129 @@
p.title && (r([p.title], g), k(g, d.header.length - 1));
p.messageTop && (r([p.messageTop],
g), k(g, d.header.length - 1));
- c.header && (r(d.header, g), i("row:last c", e).attr("s", "2"));
+ /* BEGIN ADD */
+ //c.header && (r(d.header, g), i("row:last c", e).attr("s", "2"));
+ var mgCnt = 0;
+ var merges=[];
+ if (c.header) {
+ //for each header row
+ for(i=0; i < d.header.length; i++)
+ {
+ //for each column (cell) in the row
+ for(j=0; j startrow="+endRow+">"+startRow);
+ //console.log("endCol > startcol="+endCol+">"+startCol);
+
+ if(endCol > startCol) //end column
+ merges[mgCnt] = merges[mgCnt] + ":" + eC;
+ else
+ merges[mgCnt] = merges[mgCnt] + ":" + sC;
+
+ if(endRow > startRow) //end row
+ merges[mgCnt] = merges[mgCnt] + eR;
+ else
+ merges[mgCnt] = merges[mgCnt] + sR;
+
+ //console.log("merges[mgCnt]="+merges[mgCnt]);
+
+ mgCnt++; //increment number of merge ranges
+ }
+ }
+ }
+ }
+
+ //add multiple headers
+ for (i = 0; i < b.header.length; i++){
+ d(b.header[i], e);
+ g("row c", f).attr("s", "2"); //maybe should be outside the loop?
+ }
+ }
+ /* END ADD */
for (var o = 0, u = d.body.length; o < u; o++) r(d.body[o], g);
c.footer && d.footer && (r(d.footer, g), i("row:last c", e).attr("s", "2"));
p.messageBottom && (r([p.messageBottom], g), k(g, d.header.length - 1));
+
+ /* BEGIN ADD */
+ //if we have merges
+ if (mgCnt > 0)
+ {
+ //create a mergeCells section
+ z = o(f, "mergeCells", {
+ attr: {
+ count: mgCnt,
+ }
+ });
+
+ //add each merge range as a child
+ for(i=0;i