devextreme-reactive icon indicating copy to clipboard operation
devextreme-reactive copied to clipboard

Attempted import error: 'GridExporter' is not exported from '@devexpress/dx-react-grid'.

Open ptkpyitheim opened this issue 6 years ago • 2 comments

  • [x ] I have searched this repository's issues and believe that this is not a duplicate.

I'm using ...

  • [ x] React Grid
  • [ ] React Chart
  • [ ] React Scheduler

Current Behaviour

Shows import error above when trying to use GridExporter as described in https://devexpress.github.io/devextreme-reactive/react/grid/docs/guides/export/

Expected Behaviour

To be able to use it without giving me the import error

Steps to Reproduce

I have the code as follow.

import React.. and some other imports
import { GridExporter } from "@devexpress/dx-react-grid";
import { ExportPanel } from "@devexpress/dx-react-grid-material-ui";

class UsersTable extends React.Component {
    constructor(props) {
        this.exportRef = React.ccreateRef();
    }
    render() {
        return(
            <Paper>
            <Grid rows={rows} columns={columns}>
                ......
                ......
                <ExportPanel
              startExport={(options) => exporterRef.current.exportGrid(options)}
            />
          </Grid>
          <GridExporter ref={exporterRef} columns={columns} rows={rows} />
          </Paper>
        )
}

And that gives the error as the title shows. When I comment out the GridExporter component it's fine but when I have it as above it throws me import error. Not sure what's wrong.

Environment

  • @devexpress/dx-react-core": "^2.6.4
  • @devexpress/dx-react-grid": "^2.6.4
  • @devexpress/dx-react-grid-material-ui": "^2.6.4
  • react: "^16.13.1"
  • browser: Latest Chrome
  • bootstrap: none
  • react-bootstrap: none
  • "@material-ui/core": "^4.10.1"

ptkpyitheim avatar Jul 09 '20 17:07 ptkpyitheim

Okay so I found the solution.

Apparently I cannot import as such import { GridExporter } from '@devexpress/dx-react-grid';

But I found this npm library to install specifically for dx-react-grid-export https://www.npmjs.com/package/@devexpress/dx-react-grid-export

This was failed to be mentioned in the original documentation here: https://devexpress.github.io/devextreme-reactive/react/grid/docs/guides/export/

and here https://devexpress.github.io/devextreme-reactive/react/grid/docs/reference/grid-exporter/

It would be great to update the documentation with correct installation and import statements

ptkpyitheim avatar Jul 09 '20 19:07 ptkpyitheim

Hi @ptkpyitheim,

Thank you for reporting this problem. We will update our documentation in the nearest release.

LazyLahtak avatar Jul 10 '20 10:07 LazyLahtak