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

How to de-select a cell? #1609

Closed
saunandrea opened this issue Sep 11, 2017 · 10 comments
Closed

How to de-select a cell? #1609

saunandrea opened this issue Sep 11, 2017 · 10 comments

Comments

@saunandrea
Copy link

saunandrea commented Sep 11, 2017

The problem I'm having is that if a user clicks to edit a cell but then does something on another view that changes the data and re-renders the BootstrapTable, the cell is still focused and retaining the old value until the user clicks somewhere else on the table. Neither reset nor cleanSelected seem to have any effect. Should these methods be able to do what I'm trying?

I tried the following:

onBootstrapTableRef(instance) {
    this.bootstrapTableRef = instance;
}

componentDidUpdate() {
    this.bootstrapTableRef.reset(); //feel like either of these lines should do the job
    this.bootstrapTableRef.cleanSelected();
}


public render() {
    const cellEdit = {
        mode: "click",
        blurToSave: true
    }

    return (
                <BootstrapTable data={this.props.settings} keyField="settingStage"
                    bordered={false} striped cellEdit={cellEdit} ref={this.onBootstrapTableRef}>
                    ...
                </BootstrapTable>
            </div>
        </div>
    );
}

@AllenFang
Copy link
Owner

HI @saunandrea I'll clean the cell editing state in the reset function, thanks 👍

@saunandrea
Copy link
Author

@AllenFang Wonderful, thank you! First question/issue I've ever posted and very grateful to have a such a quick response.

@AllenFang
Copy link
Owner

👍 :)

BTW, react-bootstrap-table already stop new feature development, and I've plan to rebuild it >> https://github.com/react-bootstrap-table/react-bootstrap-table2 this is still work in progress and if you think there's still something hard to use in react-bootstrap-table, I think you will be interesting on it, check it in the future and pay some attention on next generation react-bootstrap-table. Thanks 👍

@AllenFang
Copy link
Owner

Fixed on v4.0.4 and try it again, thanks

@saunandrea
Copy link
Author

@AllenFang Hey Allen, I'm sorry to say I gave it whirl and I'm still not able to get the cell selection to be reset.

@AllenFang
Copy link
Owner

ah, I only clean the cell edit, but forgot to row seleciton

@AllenFang AllenFang reopened this Sep 18, 2017
@AllenFang
Copy link
Owner

Fixed on v4.0.5.

@ajitStephen
Copy link

@saunandrea @AllenFang
How to reset edit cell in react-bootstrap-table2 ?

@craciunbogdangeorge
Copy link

craciunbogdangeorge commented Jul 29, 2018

How to leave edit mode from a cell after saving (pressing Enter triggers the afterSaveCell function, but the cursor remains active in the cell)?

@RashmiMadlerappa2018
Copy link

Hi @AllenFang
How to clear the selected rows in react-bootstrap-table2 after successful save like cleanSelected in react-bootstrap-table

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

5 participants