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

Add indeterminate state. #33

Merged
merged 3 commits into from
Aug 26, 2017
Merged

Add indeterminate state. #33

merged 3 commits into from
Aug 26, 2017

Conversation

jav
Copy link

@jav jav commented Jul 29, 2017

As described in issue/32.
A checkbox may be in three states. Checked / unchecked and indeterminate state.
Jsfiddle example

This pullrequest adds the property "isIndeterminate".
To mimic the default behavior of as closely as possible, the 'isIndeterminate' property value overrides the value of the 'isChecked' property (see the jsfiddle example above).

@jav
Copy link
Author

jav commented Jul 29, 2017

Example usage

<CheckBox
    onClick={()=>this.checkboxClick(this.checked, this.indeterminate)}
    isChecked={this.checked}
    isIndeterminate={this.indeterminate}
    leftText={"leftText"}
/>

where "this.checkboxClick()" is

checkboxClick(checked){
    console.log("from: checked:", this.checked, " indeterminate: ", this.indeterminate);
    if(this.checked === false && this.indeterminate == false) {
      this.checked = true;
      this.indeterminate = true;
    } else if(this.checked === true && this.indeterminate == true) {
      this.checked = true;
      this.indeterminate = false;
    } else if(this.checked === true && this.indeterminate == false) {
     this.checked = false;
     this.indeterminate = false;
   }
   console.log("  to: checked:", this.checked, " indeterminate: ", this.indeterminate);

  }

@jav jav mentioned this pull request Jul 29, 2017
@crazycodeboy crazycodeboy merged commit 03b3755 into crazycodeboy:master Aug 26, 2017
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

Successfully merging this pull request may close these issues.

3 participants