0

All,

I'm trying to combine FlexTable and AutoSizer (from react-virtualized) but keep getting an error that I do not quite see the reason for. As far as I can see I have followed the examples but I must be making some mistake.

My render method ends with the following

return (
        <AutoSizer disableWidth>
            {({ height }) => (
                <FlexTable
                    ref='Table'
                    className={'FlexTable'}
                    headerClassName={'headerColumn'}
                    headerHeight={35}
                    height={height}
                    noRowsRenderer={this._noRowsRenderer}
                    rowClassName={::this._rowClassName}
                    onRowClick={this._onClick}
                    rowHeight={30}
                    rowGetter={this._rowGetter}
                    rowsCount={this.state.sorted.length}
                    sort={this._sort}
                    sortBy={sortBy}
                    sortDirection={sortDirection}
                    width={370}>
                    <FlexColumn label='Org-Nr' dataKey='clientNumber' width={115}/>
                    <FlexColumn label='Namn' dataKey='name' width={255}/>
                </FlexTable>
            )}
        </AutoSizer>
    )

and what happens is that the console shows me the following warnings and the table is never rendered.

Warning: Failed propType: Invalid prop children supplied to AutoSizer, expected a single ReactElement. Check the render method of Table.

and

Uncaught Invariant Violation: onlyChild must be passed a children with exactly one child.

Now, I do understand what it is telling me I just don't see how the AutoSizer tag is given more that one child. Isn't the only child the FlexTable component?

Best regards

Daniel Södling

  • Author of react-virtualized here. The code you've pasted above works fine for me when I run it locally. I believe you'll need to provide more information for anyone to be able to offer help. – bvaughn May 23 '16 at 20:08
  • Hi, Brian! I'll try to get a more complete example together as soon as I can. Thanks for taking the time to respond. – Daniel Södling May 25 '16 at 08:04

0 Answers0