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

Programmatically enter edit mode? #25

Open
hepiyellow opened this issue Sep 12, 2016 · 1 comment
Open

Programmatically enter edit mode? #25

hepiyellow opened this issue Sep 12, 2016 · 1 comment

Comments

@hepiyellow
Copy link

Hi,

Is it possible to programmatically enter edit mode?
That is, I don't want a click to enter edit mode, rather I want the click to propagate to the parent, and not be handled by the <InlineEdit> component. And The parent component will decide when to go into edit mode.

If not, I think it will make a good addition.
For example when the label is on a button, and clicking the button does something, but pressing Shift+click will go into edit mode.

Thanks,
Erez

@lrecknagel
Copy link

lrecknagel commented Jan 18, 2017

Hey,

you can use something like that:

...
constructor(props) {
    super(props)
    this.state = {}
}

enableEdit = (_some_id, e) => {
    this.setState({
      [_some_id]: true
    })
}
...
<a onClick={(e) => this.enableEdit(_some_id, e)} >EDIT</a>
<InlineEdit
    text={_some_value}
    paramName={_some_id}
    change={this.data_changed}
    editing={this.state[_some_id] || false} />

Hope that helps ;)

Lucas

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

No branches or pull requests

2 participants