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

Use default functions/methods in remote mode

Open XidongHuang opened this issue 9 years ago • 2 comments

Hi, I found that some default functions are not working if I set remote={true}.

For example, I just want my table remote add and delete, but keep sort and search as default. But it looks like some default methods all have to be customised once the remote={true}.


 options = {
        // paginationPosition:"top",
        paginationShowsTotal: this.renderPaginationShowsTotal,
        sizePerPageList: ['10',  '30', '50', '60'],
        sizePerPage: 10,
        sizePerPageDropDown: this.renderSizePerPageDropDown,
        // exportCSVBtn: this.createCustomExportCSVButton,
        defaultSortName: 'coreId',
        defaultSortOrder: 'asc',

        onDeleteRow: this.remoteDelete,
        insertModalHeader: this.modalHeader,
        insertModalBody: this.modalBody,

        handleConfirmDeleteRow: this.confirmDelete,
        //insert
        // afterInsertRow: this.onAfterInsesrtRow,
        // insertModalBody: this.createCustomModalBody,
        onAddRow: this.onAddRow,   
    }
...
<BootstrapTable data={data} striped hover search 
                    condensed pagination insertRow deleteRow remote={true}  options={this.options} selectRow={this.selectRowProp}>

    <TableHeaderColumn isKey tdStyle={{whiteSpace: 'normal', 'wordWrap': 'break-word'}} 
                        thStyle={{whiteSpace: 'normal'}} dataFormat={this.coreIdLink} dataField="coreId" dataSort>Core ID</TableHeaderColumn>
    <TableHeaderColumn dataField="accountId" tdStyle={{whiteSpace: 'normal', 'wordWrap': 'break-word'}} 
                        thStyle={{whiteSpace: 'normal'}} dataSort>Account ID</TableHeaderColumn>    
    <TableHeaderColumn dataField="type" tdStyle={{whiteSpace: 'normal', 'wordWrap': 'break-word'}} 
                            thStyle={{whiteSpace: 'normal'}} dataSort>Type</TableHeaderColumn>
    <TableHeaderColumn dataField="timezone" tdStyle={{whiteSpace: 'normal', 'wordWrap': 'break-word'}} 
                            thStyle={{whiteSpace: 'normal'}} dataSort>Time Zone</TableHeaderColumn>
    <TableHeaderColumn dataField="lastConnectedDate" tdStyle={{whiteSpace: 'normal', 'wordWrap': 'break-word'}} 
                            thStyle={{whiteSpace: 'normal'}} dataSort>Last Connected</TableHeaderColumn>
    <TableHeaderColumn dataField="firstConnectedDate" tdStyle={{whiteSpace: 'normal', 'wordWrap': 'break-word'}} 
                            thStyle={{whiteSpace: 'normal'}} dataSort>First Connected</TableHeaderColumn>
</BootstrapTable>

Do I need to set up more so that some functions like sort, search just work as default? Or there is a API method for each of them, then I just need to import it and reference them to each other?

Thank you.

XidongHuang avatar Jul 14 '17 13:07 XidongHuang

@XidongHuang, you should doing like this to configure what function should using remote.

Let me know if you have any questions, thanks

AllenFang avatar Jul 16 '17 05:07 AllenFang

Thanks for your response! I don't know why I cannot find this example, thank you anyways!

XidongHuang avatar Jul 17 '17 12:07 XidongHuang