-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Broken formatting in both exported CSV and Excel files since v4.6.1 #6887
Comments
This should fix export csv with cellFilter. closes #6784
anyone know if this is getting fixed ? |
workaround is to override the broken default implementation by setting this in your grid options grid.options = {
// return raw call value without cellFilters being applied
exporterFieldCallback: function ( grid, row, col, value ) {
return value;
},...
} |
Extending the workaround from @johnoscott you can just apply all cellFilters by yourself: exporterFieldCallback: function ( grid, row, col, value ) {
// example for a more advanced filter
if(col.cellFilter === "date:\'dd.MM.yyyy\'") {
value = $filter('date')(value, 'dd.MM.yyyy')
//every common filter like 'currency'
} else if ( col.cellFilter !== "") {
value = $filter(col.cellFilter)(value)
}
//all cols without filter just return the value
return value;
} |
How are people not getting their build broken by the parameters not being found? I can replace grid with this.myGrid but row, col and value I'm just not sure about. I'm using typescript but can type them as any. Answer: Just add types to the parameters. e.g. (grid: uiGrid.IGridApi, row: uiGrid.IGridRow, col: uiGrid.IGridColumn, input: any) |
should be fixed by https://github.com/angular-ui/ui-grid/pull/7154/files |
Plunkr:
http://plnkr.co/edit/7yFTvr1z35AzmlZjzDUF?p=preview
Expected result (as it worked until v4.4.6):
8.99
-13.09
51.45
-1,128.65
Actual result in CSV:
null9
#NAME?
null51
-null1,129
Actual result in Excel:
null9
-null13
null51
-null1,129
It looks like the bug was introduced in the following commit:
3207b29
The code in the commit changes filter parameters from
return $filter('currency')(value, "");
to
return $filter('currency')(value, null, null);
It gives wrong output.
The text was updated successfully, but these errors were encountered: