Ag-grid: Data Export - Include filtered rows

0

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/ceolter/ag-grid/blob/master/CONTRIBUTING.md#question

Current behavior

Currently when exporting data as CSV, any data that is filtered out is not exported, even when only onlySelected is set to true. This may be confusing to the user.

Expected behavior

Even though a row is selected but filtered out, it is still selected and a user would expect it to be exported.

Ideally there would be an onlyFiltered param for Data Export that you could set to false in order to export all rows, even those that are filtered.

Minimal reproduction of the problem with instructions

  1. Grid Selection Example 2
  2. Add a break point and modify the gridOptions. Set enableFilter to true.
  3. Select Natalie Coughlin and Aleksey Nemov.
  4. Set Country filter to Russia
  5. Selection doesn't change.

If the user was to export only selected rows to CSV, they would expect both Natalie Coughlin and Aleksey Nemov to be exported.

What is the motivation / use case for changing the behavior?

See example above.

Please tell us about your environment:

N/A

  • ag-Grid version: 8.0.1

  • Browser: N/A

  • Language: all

maccuaa picture maccuaa  ·  28 Feb 2017

Most helpful comment

2

Here is a ugly but a working patch for this issue, if anyone has a better solution please suggest.

    onGridReady(params: DetailGridInfo) {
        this.gridApi = params.api;
        // Keep reference of original getType method
        const rowModel = (<any>this.gridApi).rowModel;
        rowModel._originalGetType = rowModel.getType;
        rowModel._fakeGetType = () => Constants.ROW_MODEL_TYPE_SERVER_SIDE;
    }

    onDownloadButtonClick() {
        const rowModel = (<any>this.gridApi).rowModel;
        rowModel.getType = rowModel._fakeGetType;
        this.gridApi.exportDataAsCsv({
            fileName: 'all-records'
        });
        rowModel.getType = rowModel._originalGetType;
    }

Versions

"ag-grid": "^18.1.2",
"ag-grid-angular": "^19.0.0",
"ag-grid-community": "^19.0.0",
manojdcoder picture manojdcoder  ·  16 Oct 2018

All comments

2

Hello @st-andrew

I've raised this feature request with the team. It's been added to our backlog and you can check progress on our pipeline page (AG-302):

https://www.ag-grid.com/ag-grid-pipeline/

willhalling picture willhalling  ·  1 Mar 2017
0

Thanks @willhalling

maccuaa picture maccuaa  ·  1 Mar 2017
0

Hi,

We are changing the process and closing all issues with a ticket number since they can be tracked from our pipeline https://www.ag-grid.com/ag-grid-pipeline/

Thanks

===============

If you are an ag-Grid Enterprise Customer, please raise this in our Zendesk support system - contact [email protected] for access. This is our primary channel for Support.

Bugs Raised Here:

We will do a periodic review of GitHub issues for any bugs raised and these can be tracked on our pipeline page: https://www.ag-grid.com/ag-grid-pipeline

Feature Requests/Support Raised Here:

We are reviewing how we process Feature Requests that come from GitHub. We currently have a very full pipeline of work which will be our priority for the coming months.

As a result, we don’t have capacity to take feature requests from GitHub.

We will review this as we move through our current backlog.

Thanks for your understanding.
ag-Grid Team.

makinggoodsoftware picture makinggoodsoftware  ·  19 Dec 2017
2

Here is a ugly but a working patch for this issue, if anyone has a better solution please suggest.

    onGridReady(params: DetailGridInfo) {
        this.gridApi = params.api;
        // Keep reference of original getType method
        const rowModel = (<any>this.gridApi).rowModel;
        rowModel._originalGetType = rowModel.getType;
        rowModel._fakeGetType = () => Constants.ROW_MODEL_TYPE_SERVER_SIDE;
    }

    onDownloadButtonClick() {
        const rowModel = (<any>this.gridApi).rowModel;
        rowModel.getType = rowModel._fakeGetType;
        this.gridApi.exportDataAsCsv({
            fileName: 'all-records'
        });
        rowModel.getType = rowModel._originalGetType;
    }

Versions

"ag-grid": "^18.1.2",
"ag-grid-angular": "^19.0.0",
"ag-grid-community": "^19.0.0",
manojdcoder picture manojdcoder  ·  16 Oct 2018
1

Here is a ugly but a working patch for this issue, if anyone has a better solution please suggest.

    onGridReady(params: DetailGridInfo) {
        this.gridApi = params.api;
        // Keep reference of original getType method
        const rowModel = (<any>this.gridApi).rowModel;
        rowModel._originalGetType = rowModel.getType;
        rowModel._fakeGetType = () => Constants.ROW_MODEL_TYPE_SERVER_SIDE;
    }

    onDownloadButtonClick() {
        const rowModel = (<any>this.gridApi).rowModel;
        rowModel.getType = rowModel._fakeGetType;
        this.gridApi.exportDataAsCsv({
            fileName: 'all-records'
        });
        rowModel.getType = rowModel._originalGetType;
    }

Versions

"ag-grid": "^18.1.2",
"ag-grid-angular": "^19.0.0",
"ag-grid-community": "^19.0.0",

thank you

heianqishizhisuiyuan picture heianqishizhisuiyuan  ·  13 Mar 2019
0

Has this been fixed? I'm using the hack proposed by @heianqishizhisuiyuan. It is ugly, but works! Thanks!

PablocFonseca picture PablocFonseca  ·  28 Dec 2020