bencripps / react-redux-grid

A React Grid/Tree Component written in the Redux Pattern
http://react-redux-grid.herokuapp.com/
MIT License
444 stars 63 forks source link

Using local data with tree grid generates propTypes warning #202

Closed laurenga closed 6 years ago

laurenga commented 6 years ago

When using the demo grid code the following PropTypes error is generated when trying to use the tree with local data. Warning: Failed prop type: Invalid propdataof typeobjectsupplied toGrid, expected an array.

Here's the provider.jsx setup I used to run the demo code:

import React from 'react';
import { Provider } from 'react-redux';
import { Grid, Store, applyGridConfig } from '../src';

import {
    columns,
    data,
    pageSize,
    plugins,
    events,
    dataSource,
    treeDataSource,
    stateful,
    height,
    stateKey,
    treeData,
    examplePromiseDataSource
} from '../demo/demoData';

const config = {
    columns,
    //data,
     data: treeData,
    // dataSource: treeDataSource,
    // infinite: true,
    stateful: false,
    //dataSource: examplePromiseDataSource,
    // dragAndDrop: true,
     gridType: 'tree',
    pageSize,
    plugins,
    events,
    stateKey
};

export default (
    <Provider store={ Store }>
        <Grid { ...config } />
    </Provider>
);

I suspect this is caused by the following in the Grid.jsx component: data: arrayOf(object),

bencripps commented 6 years ago

Yeah we should fix this