Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Store but Local Search / Sort #990

Closed
naorrosenberg opened this issue Jan 25, 2017 · 5 comments
Closed

Remote Store but Local Search / Sort #990

naorrosenberg opened this issue Jan 25, 2017 · 5 comments

Comments

@naorrosenberg
Copy link

I have a remote store (using MobX) and inject the data to the table component as props. I set the remote flag in the table accordingly.
Obviously I need to write my own onAddRow, onDeleteRow and onCellEdit to update the remote store, but I'd like to avoid rewriting the search and sort code.
Is there a way to use the default search / sort functionality with remote store?

@AllenFang
Copy link
Owner

@naorrosenberg, actually, it cant be done in current version, because inside the react-bootstrap-table, I always force a return if remote enabled for these operation. For example, this is a case of sorting.

However, I think your consideration is possible happen for the other user too, so I will gonna to support this feature and my solution will be like following:

remote = (remoteFunction) => {
    // remoteFunction is a object, default is all false, 
    //  { insertRow: false, dropRow: false, cellEdit: false, sort: false, pagination: false, search: false, filter: false    }
    //
    remoteFunction.insertRow = true;
    remoteFunction.dropRow = true;
    remoteFunction.cellEdit = true;
    return remoteFunction;
}

render() {
    return {
        <BootstrapTable data={data} remote={this.getRemote}
    };
}

How about above example? is that much intuitive?

@naorrosenberg
Copy link
Author

Thanks @AllenFang for such a prompt reply!

Yes - this solution would be great, thanks.
Do you expect this to enter the next beta version?

@AllenFang
Copy link
Owner

I can support this feature on next version(next week)

AllenFang added a commit that referenced this issue Feb 5, 2017
@AllenFang
Copy link
Owner

@tommiii
Copy link

tommiii commented Jul 29, 2019

I'm not able to set defaultSearch in options when remote is enable. I get 'Maximum update depth exceeded' error. Is there a solution in "react-bootstrap-table": "4.3.1" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants