Griddle supports subgrids. I have a custom component (used for row selection) in one of the fields that changes the state. This state change causes a re-render, which collapses the subgrid. However, I'd like it to stay open.
This same problem is documented in this Github issue, including this example (thanks @denzelby of Github) in which filtering collapses the subgrids.
Note in the code from the fiddle how the state is updated onCountClick
(clicking the "inc" button), causing the re-render:
var GridAndCounter = React.createClass({
render: function() {
var columnNames = ['id', 'age', 'name', 'company', 'state', 'country', 'favoriteNumber'];
var rowMetadata = {key: "id"};
return <div><Counter count={this.state.count} onClick={this.onCountClick} /><Griddle results={fakeData} rowMetadata={rowMetadata} columnNames={columnNames} resultsPerPage={100} showFilter={true} /></div>
},
onCountClick: function() {
React.addons.Perf.start();
this.setState({count: this.state.count + 1 });
setTimeout(function() {
React.addons.Perf.stop();
React.addons.Perf.printDOM();
}, 500);
},
getInitialState: function() {
return { count: 0 };
}
})
This state update causes a re-render which sets everything to collapsed. How can I keep everything expanded on re-render? I could perhaps track which ones are expanded myself, but then I would need a programmatic way to expand the rows, which I haven't discovered with Griddle.