Open slashwhatever opened 8 years ago
If you take a look at Custom Columns section http://griddlegriddle.github.io/Griddle/customization.html you will clearly see that you can include custom components. However I've run into similar issues as you've described when it comes to external data.
Thanks for the update.
However (and this is meant more as a note to other readers who come up against this issue):
If I get rid of the column property on the griddle, I get this: https://puu.sh/qMtYU/f40c59efdb.png.
Assuming this is because our api returns more than we need and the Griddle doesn't use columnMetadata as a definition of the only columns it should render, if I manipulate the returned data to strip out everything else, I get this: https://puu.sh/qMu3g/5a2d4d1134.png.
Neater, but still no custom component: https://puu.sh/qMvam/fdf6d01f47.png
This did work though (some code removed for brevity):
`
const ActiveAction = React.createClass({
render() {
return <NGXCButton btnText="Active" active={true} />;
}
});
const columnMeta = [{
columnName: 'name',
displayName: 'name'
}, {
columnName: 'shortStatus',
displayName: 'Status'
}, {
columnName: 'id',
displayName: 'id',
customComponent: ActiveAction
}];
return (
<Griddle
columnMetadata={columnMeta}
results={this.props.campaigns}
/>
);
`
So I have to wrap my NGXCButton element in a call to React.createClass in order for the Griddle to successfully render it into a cell.
Not sure if this is considered a bug, a shortfall in features or just expected convention - at least I have something I can work from :)
Thanks for documenting this! This is something that is going to be a lot nicer in 1.0 (unfortunately I've been a bit delayed in releasing this newer version)
Looking forward to 1.0 .....soon....? :)
Well :) I'm trying -- Just moved and getting ready to welcome a new baby into the world. We will see -- it's fairly close BUT trying to get the API solidified a bit more so we're not recommending basing plugins on an API that we later decide is not going to work. Also we'd like to give time for people to work with the beta a bit (when that's available) to get more eyes on everything.
Here's a brief snippet of code from a test I'm running up:
Given that this doesn't work in the browser, am I right in saying there's no way of including an existing component in a column?