Skip to content

Conversation

@tabby-or-not
Copy link

No description provided.

Copy link
Contributor

@fmr fmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! I've never done a proper review before, so here goes

return next;
}

getColumnFromKey(key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if this works:

getColumnFromKey(key) {
  const cols = this.props.columns || [];
  return cols.find(col => col.key === key);
}

handleDoubleClick(event) {
this.beginEdit();
}
editable(objectId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter much, coz I know it works, but will this also work?

editable(objectId) {
  const { isReadOnly, editor } = this.props.column;
  const editorIsSet = !!editor; // bang bang! you're a boolean.
  const readOnly = typeof(isReadOnly) === 'function' ? isReadOnly(objectId) : isReadOnly;
  return editorIsSet && !readOnly;
}

Or, closer to your original code:

editable(objectId) {
  const editorIsSet = this.props.column.editor !== false;
  let editable = editorIsSet;
  if (editorIsSet) {
    if (typeof(this.props.column.isReadOnly) === 'boolean') {
      editable = !this.props.column.isReadOnly;
    } else if (typeof(this.props.column.isReadOnly) === 'function') {
      editable = !this.props.column.isReadOnly(objectId);
    }
  }
  return editable;
}

@fmr fmr merged commit 14bfc4b into master May 15, 2017
@fmr fmr deleted the fix/disable_cells branch May 15, 2017 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants