Skip to content

Commit

Permalink
fix #1254
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed May 1, 2017
1 parent fa6da83 commit e840849
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/TableEditColumn.js
Expand Up @@ -16,6 +16,10 @@ class TableEditColumn extends Component {
};
}

valueShortCircuit(value) {
return value === null || typeof value === 'undefined' ? '' : value;
}

handleKeyPress = e => {
if (e.keyCode === 13 || e.keyCode === 9) {
// Pressed ENTER
Expand Down Expand Up @@ -170,18 +174,18 @@ class TableEditColumn extends Component {
editable.placeholder && (attr.placeholder = editable.placeholder);

const editorClass = classSet({ 'animated': shakeEditor, 'shake': shakeEditor });
fieldValue = fieldValue === 0 ? '0' : fieldValue;
let cellEditor;
if (customEditor) {
const customEditorProps = {
row,
...attr,
defaultValue: fieldValue || '',
defaultValue: this.valueShortCircuit(fieldValue),
...customEditor.customEditorParameters
};
cellEditor = customEditor.getElement(this.handleCustomUpdate, customEditorProps);
} else {
fieldValue = fieldValue === 0 ? '0' : fieldValue;
cellEditor = editor(editable, attr, format, editorClass, fieldValue || '');
cellEditor = editor(editable, attr, format, editorClass, this.valueShortCircuit(fieldValue));
}

if (isFocus) {
Expand Down

0 comments on commit e840849

Please sign in to comment.