/* @flow */
/**
 * @jsx React.DOM
 */
'use strict';

var React                   = require('react');

var CheckBoxEditor = React.createClass({


  PropTypes : {
    value : React.PropTypes.bool.isRequired,
    rowIdx : React.PropTypes.number.isRequired
  },

  render(): ?ReactElement{
    return (<input className="react-grid-CheckBox" type="checkbox" checked={this.props.value} onChange={this.handleChange} />);
  },

  handleChange(e: Event){
    this.props.column.onRowSelect(this.props.rowIdx)
  },

  shouldComponentUpdate(nextProps: any, nextState: any): boolean{
    return this.props.value != nextProps.value;
  }

});

module.exports = CheckBoxEditor;

/* @flow */
/**
 * @jsx React.DOM
 */
'use strict';

var React                   = require('react');

var CheckBoxEditor = React.createClass({


  PropTypes : {
    value : React.PropTypes.bool.isRequired,
    rowIdx : React.PropTypes.number.isRequired
  },

  render(): ?ReactElement{
    var checked = this.props.value != null ? this.props.value : false;
    return (<input className="react-grid-CheckBox" type="checkbox" checked={checked} onClick={this.handleChange} />);
  },

  handleChange(e: Event){
    e.stopPropagation();
    this.props.column.onRowSelect(this.props.rowIdx)
  }
});

module.exports = CheckBoxEditor;

replace onChange with onClick