Closed dmitry-borzov closed 3 years ago
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: https://github.com/angular-ui/ui-grid/commit/3207b292445617d5477e5aee5d23d160b3c8bf62
The code in the commit changes filter parameters from
return $filter('currency')(value, "");
toreturn $filter('currency')(value, null, null);
It gives wrong output.