Skip to content

Commit 71041ea

Browse files
committed
fix bug for wrong select options
1 parent 5bb23cd commit 71041ea

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Editor.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Utils from './util';
12
import React from 'react';
23

34
const editor = function(editable, attr, format, editorClass, defaultValue, ignoreEditable, row) {
@@ -35,7 +36,11 @@ const editor = function(editable, attr, format, editorClass, defaultValue, ignor
3536

3637
if (editable.type === 'select') {// process select input
3738
let options = [];
38-
const { values, textKey, valueKey } = editable.options;
39+
let { values } = editable.options;
40+
const { textKey, valueKey } = editable.options;
41+
if (Utils.isFunction(values)) {
42+
values = values(row);
43+
}
3944
if (Array.isArray(values)) {// only can use arrray data for options
4045
let text;
4146
let value;
@@ -52,8 +57,6 @@ const editor = function(editable, attr, format, editorClass, defaultValue, ignor
5257
);
5358
}
5459
);
55-
} else if (values && typeof values === 'function') {
56-
options = values(row);
5760
}
5861
return (
5962
<select { ...attr } defaultValue={ defaultValue }>

0 commit comments

Comments
 (0)