Document toolboxDocument toolbox

Tabulator

Tabulator provides the javascript handling of tables. Tabulator uses jspdf and SheetJS.

How we use it

This is a list of some of the tasks that define how Tabulator should work within Microbizz



https://system15.microbizz.dk/sys/todo/details/?id=14507 How the select all / mark all funktions should work



Bugfixes

Mouse event

We fixed a bug in version 3.5.2 : in the function ResizeColumns.prototype._mouseDown():

The line

 $("body").off("mouseup", mouseMove);

was changed to

 $("body").off("mouseup", mouseUp);

This was reported to the author, but would only be included in the 4.0 release.

Changes

Money format in Excel

Version 3.5.2 does not allow the number format to be specified when exporting Excel via the xlsx.js javascript library.

We added support for this by changing the function rowsToSheet():

  case "number":

    cell.t = 'n';

    break;

was changed to

  case "number":

     cell.t = 'n';
     var coldef = self.columnsByIndex[j].definition;
     if (coldef.isMoney)    cell.z = '0.00';

     break;

In version 4.2 the Excel has changed. The following has been inserted into Download.prototype.downloaders / xlsx() / generateSheet() / rowsToSheet(), after

XLSX.utils.sheet_add_aoa(sheet, rows);

in order to select the Excel money format:

// set money format
if (rows.length > 0) {
  var row = rows[0]; // use first row to extract columns
  row.forEach(function(value, j) {
    var coldef = self.columnsByIndex[j].definition;
    if (!coldef.isMoney)   return;
    // money format, go through all rows and set the format for cells in this column
    for (var i = 0; i < rows.length; i++) {
      var c = XLSX.utils.encode_cell({ c: j, r: i });
      if (!sheet[c])   continue;
      sheet[c].z = '0.00';
    }
  });
}