Griddle: Additional columns in Griddle 0.5.1 - data below not showing

I don’t know if this was originally an unintended piece of functionality, or if it’s broken now, but adding extra columns to an instance of Griddle no longer works in the current new version (0.5.1). I get a JSON response from an API which contains 5 fields, all of which are set to be displayed in the grid. However, I also need an extra column to be shown to include some other information, so I added another column to the columns array with a random name, and added the corresponding metadata (which refers to a customComponent) to the columnMetadata array.

In version 0.3.1, this works and I see the information from the customComponent come through in that column. But in version 0.5.1, I can see the heading for the extra column, but the column below is empty and the customComponent isn’t rendered (inserting a console.log into the custom component proves the code is never hit as nothing is written to the console).

I don’t remember this being documented anywhere at the time (it was very much a “hit and hope” scenario) but I thought I’d ask the question here in case it’s known of, but I can’t see any current issues open for it though, or if it’s changed and I’m now doing something wrong?

Code snippets:

<Griddle columns={["sku","category","description","price","basketOptions"]} columnMetadata={[ ... removed other metadata for simplicity ... {columnName:"basketOptions",displayName:"Options",customComponent:BasketOptions}]} />

and the customComponent (reduced to just show static text for simplicity) is:

class DummyColumnComponent extends React.Component { render() { return( <div>text</div> ); } }

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Thank you for this example and for the explanation! I’ll try to get this resolved and released this weekend! Sorry about any problems that is causing.

I’m also experiencing this issue with 0.5.1! @ryanlanciaux any update on when this might be resolved? It’s currently preventing me from updating to React 15 as I’m having to stay with Griddle 0.3.1 which requires React 14!

Cheers!

I fount a workaround, need manually add on first element of results a missing field…

In my case columnName “actions” not exists in results, so

this.state.users[0].actions = 'something';

<Griddle results={this.state.users} columnMetadata={columnMeta} showFilter={true} showSettings={true} useFixedHeader={true} columns={columns} onRowClick={this.onRowClick.bind(this)} />

Yes, downgrading worked for me.