How to get rid of console warning "enableRowSelect has been deprecated... Please use rowSelection instead.""

Viewed 554

) I'm using React Data Grid(https://adazzle.github.io/react-data-grid/) a few times in my app. I've noticed that there is a console warning for a prop "enableRowSelect", that prints whether you are using the aforementioned prop or not.


Console Warning:

enableRowSelect has been deprecated and will be removed in a future version. Please use rowSelection instead

minimal, reproducible example
Install RDG
$ npm install react-data-grid --save
or with yarn:
$ yarn add react-data-grid

file.tsx

import React from 'react';
import ReactDataGrid from 'react-data-grid';

const columns = [
  { key: 'id', name: 'ID' },
  { key: 'title', name: 'Title' },
  { key: 'count', name: 'Count' } ];

const rows = [{id: 0, title: 'row1', count: 20}, {id: 1, title: 'row1', count: 40}, {id: 2, title: 'row1', count: 60}];

function HelloWorld() {
  return (
    <ReactDataGrid
      columns={columns}
      rowGetter={i => rows[i]}
      rowsCount={3}
    />
  );
}

check your console

That's actually snippet from:
https://adazzle.github.io/react-data-grid/docs/examples/simple-grid
You can check your console warnings @ that linked page as well.

I expect that when I'm using the base grid as described in the docs, that there will be no errors/warnings.

     ?                                0     1     1
 ><({,''>                         <'',}})><   1   0          
                                   0   1  0                

1 Answers

Workaround: Set prop 'enableRowSelect' to null :

<ReactDataGrid
  columns={this.state.columns}
  rowGetter={this.rowGetter}
  rowsCount={this.getSize()}

  enableRowSelect={null}

  />

Edit: It appears that it will be fixed in the 7.0.0 release. The fix is included in 7.0.0-alpha.18. More details here

Related