dataField does not support dot notation
const columns = [
{
text: 'Claimed By',
dataField: 'claimBy.name',
filter
}
]
The BootstrapTable does not show records in the Claimed By column when the dataFields value is a string with dot notation. This does not allow me to build a proper url and use the onTableChange method to make an HTTP request to get filtered table data from the server.
When I change the data passed to the table and the columns value to:
const columns = [
{
text: 'Claimed By',
dataField: 'claimBy',
filter
}
]
then the BootstrapTable shows proper records in the Claimed By column.
I am using: "react-bootstrap-table-next": "^0.1.4", "react-bootstrap-table2-filter": "^0.1.3", "react-bootstrap-table2-paginator": "^0.1.1",
@anikakalbrun sorry for lately reply, can I check your raw data? I think nested field is support from the starting of react-bootstrap-table2, thanks
Hi Allen,
Thanks a lot for getting back to me.
This code is not working for me:
` const columns = [ { text: "Claimed By", dataField: "claimBy.name" }, { text: "Expenses", dataField: "totalExpenses" } ];
class ExpensesTable extends React.Component {
render() {
const {data} = this.props;
return (
<BootstrapTable keyField="id"
data={data}
columns={columns}
hover
/>
)
}
}
function mapStateToProps() { return { data: [ { "id": "4ca067bd-39f5-4fee-b23e-eaea2f5e033e", "claimBy.name": "Diane Diaz", "totalExpenses": 1124.39 } ] }; }
export default connect(mapStateToProps)(ExpensesTable); ` The first column stays empty.
@anikakalbrun sorry, your data should be following:
{
id: "4ca067bd-39f5-4fee-b23e-eaea2f5e033e",
claimBy: { .name: 'Diane Diaz' },
totalExpenses: 1124.39
}
Hey @AllenFang, Is there a way to disable to disable the processing of dot notation as a nested object? I would like to retain the column as
"claimBy.name": "Diane Diaz"