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

Unable to set Checkbox to selected/unselected via code #273

Open
vishal1785 opened this issue Aug 7, 2018 · 1 comment
Open

Unable to set Checkbox to selected/unselected via code #273

vishal1785 opened this issue Aug 7, 2018 · 1 comment

Comments

@vishal1785
Copy link

I have a use case where I want to select the chkbox on the basis of data which I'm reading from an API.

So, If that particular checkbox was selected while posting to the data to the server, I want to make it selected then next time user looks for the same record.

I'm using these components:
FormControlLabel from '@material-ui/core/FormControlLabel'
Checkbox from 'redux-form-material-ui'
and redux form

My Code is something like this-
<FormControlLabel
control={
<Field
name={${this.props.postParam}.${key}}
checked={ // some condition here on basis of remote api data }
component={this.checkboxAdapter}
/>
}

checkboxAdapter(inputProps) {
console.log(inputProps)
return (
<Checkbox
{...inputProps}
value={inputProps.input.value}
onChange={inputProps.input.onChange}
checked={inputProps.checked}
/>);
}

@xavierfuentes
Copy link

This is still an issue, any progress?

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