react-redux-grid
react-redux-grid copied to clipboard
gridType: 'tree' - static data object - exception expecting array.
I am planning to use react-redux-grid in tree mode with pouchdb/couchdb for persistence and multi user synchronisation.
I have used create-react-app and passed the tree data directly to the grid rather than using the method in the tree example using datasource. The tree data is displayed OK, but I get an exception:
Warning: Failed prop type: Invalid prop data
of type object
supplied to Grid
, expected an array.
I don't think I am doing anything wrong, but there is obviously an inconsistency with 'data' supplied to a flat grid as an array, but to a tree grid as a single root object. Perhaps the tree grid should also take an array of the the root object's children?
That could work; it would require a major release, but that would be OK. PR's welcome!
I think if the the grid accepted either a single root node, or an array of its children, then it would be compatible and not require a major release.
It is about 12 years since I did any serious programming (in Smalltalk and Eiffel). git and its procedures are still a bit of a mystery to me as well as the mess that is the javascript language. But I am learning. I will try to understand how the code could be changed to accept either. But please be gentle with me if I ask stupid questions.
I think I found the reason this exception is being raised. Line 224 of Grid.jsx uses "oneOf", I believe it should be "oneOfType".
I would raise a pull request if I could work out how to do it, but in the meantime, I thought I would point out the fix.
Gordon
Hello Ben,
I see that you changed Grid.jsx to use "oneOf" at line 224, but I think it should use "oneOfType".
I am now a bit further but am failing at line 171 in componentDidMount in FixedHeader.jsx. The call:
const headerDOM = ReactDOM.findDOMNode(this);
returns null, and it all goes a bit haywire after that. I have tried to diagnose why the return is null, but I can't work it out. The header row is displayed at this point, and all the DOM elements appear to be set up. I am guessing that the FixedHeader is not correctly initialised but I don't know enough to work out what is missing.
Gordon Jones