react-bootstrap-table icon indicating copy to clipboard operation
react-bootstrap-table copied to clipboard

Sorting doesn't work with remote

Open kopaygorodsky opened this issue 9 years ago • 12 comments

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 avatar Jun 24 '16 17:06 kopaygorodsky

@kopaygorodsky, sorry for lately reply. Could you please show your example and have checked example

AllenFang avatar Jun 26 '16 15:06 AllenFang

@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>

kopaygorodsky avatar Jun 26 '16 16:06 kopaygorodsky

@AllenFang sorry, it was my stupid mistake. There are no bugs.

kopaygorodsky avatar Jun 27 '16 09:06 kopaygorodsky

@kopaygorodsky, that's ok. Enjoy this package :)

AllenFang avatar Jun 27 '16 12:06 AllenFang

@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 avatar Feb 01 '18 21:02 9005

@9005 I don't remember exactly :) show me the code, maybe I'll follow up with smth.

kopaygorodsky avatar Feb 02 '18 23:02 kopaygorodsky

@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

9005 avatar Feb 27 '18 12:02 9005

hey @kopaygorodsky

using this code data field are not displayed.

<TableHeaderColumn dataField="name" dataSort={true} filter={{type: "TextFilter"}} dataFormat={this.linkFormatter}>Name</TableHeaderColumn>

MaheshK02 avatar Jul 07 '18 08:07 MaheshK02

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 avatar Jan 18 '19 07:01 anuragb26

@anuragb26 Did you figure out the issue ?

mandeepm91 avatar Nov 11 '20 14:11 mandeepm91

@mandeepm91 Did you solved the Issue?

ghost avatar Feb 11 '21 13:02 ghost

I reopened the issue because of multiple complaints. I don't remember why it was happening, but seems it wasn't only me.

kopaygorodsky avatar Feb 11 '21 14:02 kopaygorodsky