Closed googol7 closed 7 years ago
I spent quite some time to find out that my rows got to have an _index property to show the expand / collapse icon. So I think it would be very helpful for beginners if the datastructure example at the beginning of the REAMDE.md would include it:
const tree = [ { _index: 0, id: 123, name: 'Demo' }, { _index: 1, id: 456, name: 'Another', parent: 123 }, { _index: 2, id: 789, name: 'Yet Another', parent: 123 }, { _index: 3, id: 532, name: 'Foobar' } ];
I found out by looking at the sourcecode at https://github.com/reactabular/treetabular/blob/master/src/toggle-children.js#L7
getIndex = rowData => rowData._index, // Look for index based on convention
I spent quite some time to find out that my rows got to have an _index property to show the expand / collapse icon. So I think it would be very helpful for beginners if the datastructure example at the beginning of the REAMDE.md would include it:
I found out by looking at the sourcecode at https://github.com/reactabular/treetabular/blob/master/src/toggle-children.js#L7
getIndex = rowData => rowData._index, // Look for index based on convention