react-bootstrap-table2: setState in selectRow.onSelect will break the row expand
Not sure if I missed something in the docs, but my rows are only expanding when the ExpansionHeaderCell is clicked. When inspecting with my React dev tools, I set my props expanded: true and it only changes the + to -, without expanding the data. It renders fine when the header is clicked. Not sure if I’m just missing a prop somewhere?
const columns = [
{
dataField: "jobOrderNumber",
text: "Job #"
},
{
dataField: "profitCenter",
text: "Profit Center"
},
{
dataField: "customer",
text: "Customer"
},
{
dataField: "year",
text: "Year"
},
{
dataField: "make",
text: "Make"
},
{
dataField: "model",
text: "Model"
}
];
const selectRow = {
mode: "radio",
clickToSelect: true,
selected: [this.state.jobOrderValue],
clickToExpand: true,
onSelect: (row, isSelect, selected, e) => {
this.handleOnSelect(row, isSelect, selected, e);
}
};
const expandRow = {
renderer: row => (
<div>
<p>{`This Expand row is belong to rowKey ${row.jobOrderNumber}`}</p>
<p>You can render anything here, also you can add additional data on every row object</p>
<p>expandRow.renderer callback will pass the origin row object to you</p>
</div>
),
showExpandColumn: true
// expandByColumnOnly: true
}
<BootstrapTable
keyField={"jobOrderNumber"}
data={this.state.matchedJobs}
columns={columns}
loading={true}
bootstrap4={true}
id={"MultipleJobsTable"}
hover={true}
selectRow={selectRow}
expandRow={ expandRow }
/>
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (6 by maintainers)
RELEASE NOTE
now you can call
setStateinselectRow.onSelectand we support a feature that you can reject the selection, please check this and here is exampleTried to work my way around it using the events.onClick option in the columns object, but it also breaks the expand.
Please look it it 😢 we would really apreciated