@@ -170,6 +170,7 @@ class NumberFilter extends Component {
170170 render ( ) {
171171 const { isSelected } = this . state ;
172172 const {
173+ id,
173174 column,
174175 options,
175176 style,
@@ -188,6 +189,9 @@ class NumberFilter extends Component {
188189 ${ ! isSelected ? 'placeholder-selected' : '' }
189190 ` ;
190191
192+ const comparatorElmId = `number-filter-comparator-${ column . dataField } ${ id ? `-${ id } ` : '' } ` ;
193+ const inputElmId = `number-filter-column-${ column . dataField } ${ id ? `-${ id } ` : '' } ` ;
194+
191195 return (
192196 < div
193197 onClick = { e => e . stopPropagation ( ) }
@@ -196,13 +200,13 @@ class NumberFilter extends Component {
196200 >
197201 < label
198202 className = "filter-label"
199- htmlFor = { `number-filter-comparator- ${ column . text } ` }
203+ htmlFor = { comparatorElmId }
200204 >
201205 < span className = "sr-only" > Filter comparator</ span >
202206 < select
203207 ref = { n => this . numberFilterComparator = n }
204208 style = { comparatorStyle }
205- id = { `number-filter-comparator- ${ column . text } ` }
209+ id = { comparatorElmId }
206210 className = { `number-filter-comparator form-control ${ comparatorClassName } ` }
207211 onChange = { this . onChangeComparator }
208212 defaultValue = { this . getDefaultComparator ( ) }
@@ -214,12 +218,12 @@ class NumberFilter extends Component {
214218 options ?
215219 < label
216220 className = "filter-label"
217- htmlFor = { `number-filter-column- ${ column . text } ` }
221+ htmlFor = { inputElmId }
218222 >
219223 < span className = "sr-only" > { `Select ${ column . text } ` } </ span >
220224 < select
221225 ref = { n => this . numberFilter = n }
222- id = { `number-filter-column- ${ column . text } ` }
226+ id = { inputElmId }
223227 style = { numberStyle }
224228 className = { selectClass }
225229 onChange = { this . onChangeNumberSet }
@@ -228,11 +232,11 @@ class NumberFilter extends Component {
228232 { this . getNumberOptions ( ) }
229233 </ select >
230234 </ label > :
231- < label htmlFor = { `number-filter-column- ${ column . text } ` } >
235+ < label htmlFor = { inputElmId } >
232236 < span className = "sr-only" > { `Enter ${ column . text } ` } </ span >
233237 < input
234238 ref = { n => this . numberFilter = n }
235- id = { `number-filter-column- ${ column . text } ` }
239+ id = { inputElmId }
236240 type = "number"
237241 style = { numberStyle }
238242 className = { `number-filter-input form-control ${ numberClassName } ` }
@@ -250,6 +254,7 @@ class NumberFilter extends Component {
250254NumberFilter . propTypes = {
251255 onFilter : PropTypes . func . isRequired ,
252256 column : PropTypes . object . isRequired ,
257+ id : PropTypes . string ,
253258 filterState : PropTypes . object ,
254259 options : PropTypes . arrayOf ( PropTypes . number ) ,
255260 defaultValue : PropTypes . shape ( {
@@ -305,7 +310,8 @@ NumberFilter.defaultProps = {
305310 comparatorStyle : undefined ,
306311 comparatorClassName : '' ,
307312 numberStyle : undefined ,
308- numberClassName : ''
313+ numberClassName : '' ,
314+ id : null
309315} ;
310316
311317export default NumberFilter ;
0 commit comments