Skip to content

Fix export csv with cellFilter. Handle filters with 3 arguments #6787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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