Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gridType: 'tree' - static data object - exception expecting array. #204

Open
GordonJones opened this issue Feb 9, 2018 · 4 comments
Open

Comments

@GordonJones
Copy link

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?

@bencripps
Copy link
Owner

That could work; it would require a major release, but that would be OK. PR's welcome!

@GordonJones
Copy link
Author

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.

@GordonJones
Copy link
Author

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

@GordonJones
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants