bencripps / react-redux-grid

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

FixedHeader.jsx - fail to find DOM Node #207

Closed GordonJones closed 6 years ago

GordonJones commented 6 years ago

I mentioned this failure in #204 but it is unrelated to that problem, so I raise it here as a separate issue.

A couple of weeks ago I was displaying a simple tree, but in the past week I have stepped backward. I cannot tell if I am doing something stupid, whether I have hit a compatibility issue, or whether there is a genuine failure in FixedHeader.jsx.

But essentially when I try to render the grid this line in FixedHeader.jsx returns null.

var headerDOM = _reactDom2.default.findDOMNode(this);

Has anyone else hit this issue? Below is my trivial app.js

`import React, { Component } from 'react'; import { Provider } from 'react-redux'; import { Grid, Store } from 'react-redux-grid' import './App.css';

const treeData = { root:{ id:-1, Name:"Root", parentId:null, children:[ { id:1, parentId:-1, Name:"Category 1", children:[] } ] } }

const plugins = { COLUMN_MANAGER: { resizable: true, moveable: true, sortable: { enabled: true, method: 'local', sortingSource: null } } };

const events = { HANDLE_CELL_CLICK: (cell, reactEvent, id, browserEvent) => { console.log('On Cell Click Event'); } };

const columns = [ { name: 'Name', width: '30%', className: 'additional-class', dataIndex: 'Name', sortable: false, expandable: true } ];

const gridConfig = { showTreeRootNode: false, dataSource: null, data: treeData, gridType: 'tree', dragAndDrop: true, columns: columns, events: events, plugins: plugins, stateKey: 'oneAndOnlyTree' };

class App extends Component { render() { return ( <Provider store={ Store }> <Grid { ...gridConfig } /> ); } }

export default App; ` and my package.json

{ "name": "ambition", "version": "0.1.0", "private": true, "dependencies": { "file-loader": "^1.1.6", "font-awesome": "^4.7.0", "react": "^16.2.0", "react-dom": "^16.2.0", "react-redux": "^5.0.2", "react-redux-grid": "^5.5.2", "react-scripts": "1.1.0", "redux": "^3.7.2" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" } }

GordonJones commented 6 years ago

So I threw everything away. Created a new react app. Installed the npm registered version of react-redux-grid and its loading OK now. I don't know how I got to this failure. I am guessing its was as a result of me trying to use the latest master checkout version. Anyway apologies for the issue - I'll close and start again. Gordon