Skip to content

Commit

Permalink
fix(exporter): Handle filters with 3 arguments
Browse files Browse the repository at this point in the history
This should fix export csv with cellFilter.

closes #6784
  • Loading branch information
gine authored and mportuga committed Jul 3, 2018
1 parent 7fc39ad commit 3207b29
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/features/exporter/js/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,13 @@
function defaultExporterFieldCallback(grid, row, col, value) {
// fix to handle cases with 'number : 1' or 'date:MM-dd-YYYY', etc.. We needed to split the string
if (col.cellFilter) {
return $filter(col.cellFilter.split(': ')[0].trim())(value);
var args, filter, arg1, arg2;
// remove space, single/double to mantein retro-compatibility
args = col.cellFilter.replace(/[\'\"\s]/g, "").split(':');
filter = args[0] ? args[0] : null;
arg1 = args[1] ? args[1] : null;
arg2 = args[2] ? args[2] : null;
return $filter(filter)(value, arg1, arg2);
} else {
return value;
}
Expand Down

1 comment on commit 3207b29

@dmitry-borzov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes introduce a new bug:
#6887

Please sign in to comment.