@bouzafr Griddle internal state uses ImmutableJS, including data
, and we don't convert back to plain JS before assigning value
that's passed through to custom components (https://github.com/GriddleGriddle/Griddle/blob/e0384403ae3997543c13cd5e41aeb54e151ddbbf/src/selectors/dataSelectors.js#L268-L278). See GriddleGriddle/Griddle#773 for some related discussion. I generally agree that converting back to JS would be a better experience, but that's a breaking change.
If you don't want your presentation component to know about ImmutableJS, two options come to mind:
1) provide your own CellContainer
that's basically identical to the existing one but using a different cellValueSelector
2) write a higher-order component to wrap your plain component, e.g.
const valueToJS =
OriginalComponent =>
({ value, ...otherProps }) => (
<OriginalComponent value={Iterable.isIterable(value) ? value.toJS() : value} {...otherProps} />
);
...
<ColumnDefinition id="item2" customComponent={valueToJS(myCustomComponent)} />
dist/
. It looks like as of npm@5
we just need to rename build
to prepare
: https://github.com/npm/npm/issues/3055#issuecomment-304698029
renderControls() {
return (
<div>
<div className="pull-right">
<label className="ui-checkbox">
<input
name="toggleThing"
type="checkbox"
checked={this.props.doToggle}
onChange={() => {}}
/>
<span>Toggle</span>
</label>
</div>
</div>
);
}
render() {
const NewLayout = FullLayout({
additionalControls: this.renderControls(),
showFilter: true,
showPagination: myData.length > 100
});
return (
<Griddle
data={myData
plugins={[plugins.LocalPlugin]}
pageProperties={{ pageSize: 100 }}
components={{ Layout: NewLayout }}
>
....
}