react-bootstrap-table
react-bootstrap-table copied to clipboard
Sorting doesn't work with remote
I use remote={true} and in this case sorting doesn't work, in onSortChange, I always get name + desc and see dropup and dropdown icons
SortOrder couldn't change when I click
Without remote it works well.
@kopaygorodsky, sorry for lately reply. Could you please show your example and have checked example?
@AllenFang Yes, of course, I checked.
<BootstrapTable
data={data}
deleteRow={true}
hover={true}
multiColumnSearch={true}
selectRow={this.getSelectRowProp()}
remote={true}
pagination={true}
fetchInfo={ { dataTotalSize: +this.state.contactsCount } }
options={
{
afterDeleteRow: this.afterDeleteRow.bind(this),
sizePerPage: this.state.pagination.sizePerPage,
onPageChange: this.state.pagination.onPageChange,
sizePerPageList: [20, 30, 40, 50 ],
page: this.state.pagination.currentPage,
onSizePerPageList: this.state.pagination.onSizePerPageList,
onSortChange: this.state.pagination.onSortChange
}
}
>
<TableHeaderColumn hidden={true} dataField="id" isKey={true}> ID</TableHeaderColumn>
<TableHeaderColumn dataField="name" dataSort={true} filter={{type: "TextFilter"}} dataFormat={this.linkFormatter}>Name</TableHeaderColumn>
<TableHeaderColumn dataField="email" dataSort={true} filter={{type: "TextFilter"}}>Email</TableHeaderColumn>
<TableHeaderColumn dataField="tags" dataSort={true} filter={{type: "TextFilter"}} >Tags</TableHeaderColumn>
<TableHeaderColumn dataField="categories" dataSort={true} filter={{type: "TextFilter"}}>Categories</TableHeaderColumn>
<TableHeaderColumn dataField="addresses" dataSort={true} hidden={true} filter={{type: "TextFilter"}}>Addresses</TableHeaderColumn>
<TableHeaderColumn dataField="media" dataSort={true} filter={{type: "TextFilter"}}>Media</TableHeaderColumn>
</BootstrapTable>
@AllenFang sorry, it was my stupid mistake. There are no bugs.
@kopaygorodsky, that's ok. Enjoy this package :)
@kopaygorodsky : Hi Man, I am facing the same issue. I am not able to sort or filter when i have remote = true. What was your issue?
@9005 I don't remember exactly :) show me the code, maybe I'll follow up with smth.
@AllenFang : <BootstrapTable data={this.props.displayGuestFileDetails} remote={true} fetchInfo={ { dataTotalSize: this.props.countOfGuests } } pagination={true} options={{nextPage: 'Next',firstPage: 'First',lastPage: 'Last', sizePerPage: 1,sizePerPageList: [ 1,2,3 ]}} exportCSV={ true } tableHeaderClass="tableHeader"> sizePerPage is not working for me . I have set fetchInfo count as 2 which is value coming from API but I display all rows. Rather i should display only 1 row. Please help
hey @kopaygorodsky
using this code data field are not displayed.
<TableHeaderColumn dataField="name" dataSort={true} filter={{type: "TextFilter"}} dataFormat={this.linkFormatter}>Name</TableHeaderColumn>
kopaygorodsky , i am facing the exact same issue,getting order as 'desc' always,Could you please describe your fix.
<BootstrapTable
remote
keyField={'id'}
bootstrap4
classes={'mt-3'}
rowClasses={'table__row'}
headerClasses={'table__header'}
bordered={false}
data={data}
columns={columns}
pagination={ paginationFactory(paginationOptions) }
onTableChange={ onTableChange }
/>
)
In onTableChange, i always get desc and both carets are always visible.
@anuragb26 Did you figure out the issue ?
@mandeepm91 Did you solved the Issue?
I reopened the issue because of multiple complaints. I don't remember why it was happening, but seems it wasn't only me.