Skip to content
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

fix: export filter with time part. ('date:"MM-dd-YYYY HH:mm'). #7154

Merged
merged 1 commit into from
Jul 31, 2021
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
15 changes: 8 additions & 7 deletions packages/exporter/src/js/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1653,14 +1653,15 @@
}

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
// fix to handle cases with 'number : 1' or 'date:"MM-dd-YYYY HH:mm"', etc.. We needed to split the string
if (col.cellFilter) {
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;
var args, filter, arg1, arg2;
// Split on ':' except when in double quotes.
args = col.cellFilter.match(/(?:[^:"]+|"[^"]*")+/g);
// remove space, single/double to maintain retro-compatibility, but keep spaces in second argument (arg[1])
filter = args[0] ? args[0].replace(/[\'\"\s]/g, "") : null;
arg1 = args[1] ? args[1].replace(/[\'\"]/g, "").trim() : null;
arg2 = args[2] ? args[2].replace(/[\'\"\s]/g, "") : null;
return $filter(filter)(value, arg1, arg2);
} else {
return value;
Expand Down