Skip to content

Commit 61a2d8c

Browse files
committed
fix #1248
1 parent 1a6ca0a commit 61a2d8c

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/filters/Number.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ class NumberFilter extends Component {
8585

8686
getNumberOptions() {
8787
const optionTags = [];
88-
const { options } = this.props;
88+
const { options, withoutEmptyOption } = this.props;
8989

90-
optionTags.push(
91-
<option key='-1' value=''>
92-
{ this.props.placeholder || `Select ${this.props.columnName}...` }
93-
</option>
94-
);
90+
if (!withoutEmptyOption) {
91+
optionTags.push(
92+
<option key='-1' value=''>
93+
{ this.props.placeholder || `Select ${this.props.columnName}...` }
94+
</option>
95+
);
96+
}
9597
for (let i = 0; i < options.length; i++) {
9698
optionTags.push(<option key={ i } value={ options[i] }>{ options[i] }</option>);
9799
}

src/filters/Select.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ class SelectFilter extends Component {
5757

5858
getOptions() {
5959
const optionTags = [];
60-
const { options, placeholder, columnName, selectText } = this.props;
60+
const { options, placeholder, columnName, selectText, withoutEmptyOption } = this.props;
6161
const selectTextValue = (selectText !== undefined) ? selectText : 'Select';
62-
optionTags.push((
63-
<option key='-1' value=''>{ placeholder || `${selectTextValue} ${columnName}...` }</option>
64-
));
62+
if (!withoutEmptyOption) {
63+
optionTags.push((
64+
<option key='-1' value=''>{ placeholder || `${selectTextValue} ${columnName}...` }</option>
65+
));
66+
}
6567
Object.keys(options).map(key => {
6668
optionTags.push(<option key={ key } value={ key }>{ options[key] + '' }</option>);
6769
});

0 commit comments

Comments
 (0)