Skip to content

Instantly share code, notes, and snippets.

@joeldbirch
Created February 21, 2017 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeldbirch/31b811e3320ae6d32fa101926fdda472 to your computer and use it in GitHub Desktop.
Save joeldbirch/31b811e3320ae6d32fa101926fdda472 to your computer and use it in GitHub Desktop.
Quick Admin bugfix for checkboxes in table cells
var handleCheckboxes = function (html, rowIndex, colIndex, cellNode) {
var $cellNode = $(cellNode);
var $check = $cellNode.find(':checked');
return ($check.length) ? $check.val() : $cellNode.text();
}
// Then add to exportOptions.format.body option for each file type, eg:
[...]
{
extend: 'csv',
exportOptions: {
columns: ':visible',
format: {
body: handleCheckboxes
}
}
}
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment