AllenFang / react-bootstrap-table

A Bootstrap table built with React.js
https://allenfang.github.io/react-bootstrap-table/
MIT License
2.24k stars 783 forks source link

Cannot read property 'sortFunc' of undefined - when using map function to generate TableHeaderColumn #2094

Open smelehy opened 4 years ago

smelehy commented 4 years ago

I can't seem to figure this out. Looked at all the documents and support blogs. Hard coding TableHeader Column works, doing the same thing with map function does not work. Sorry if the code is not readable - I'm new to submitting these.

This code works: `ID

Status

<TableHeaderColumn width='13%' dataField='created' dataSort {false}>Created

User Name Tenant Name Email Phone Topic

`

This code generates the 'sortFunc' undefined error: ` var listcolhdrs = this.state.tablehdr.map((column) => { return ( <TableHeaderColumn key={column[1]} dataField={column[2].fieldname} isKey={column[2].iskey}> {column[2].label} )}); return (

{listcolhdrs}
</div>
); `
smelehy commented 4 years ago

Can you provide any examples where the map function is used to generate the TableHeaderColumn? That might help.