add a defaultValue parameter to the ReportFilters component
This commit is contained in:
parent
0162adf532
commit
f529143e14
|
@ -74,7 +74,7 @@ class FilterPicker extends Component {
|
||||||
getFilter( value ) {
|
getFilter( value ) {
|
||||||
const { config, query } = this.props;
|
const { config, query } = this.props;
|
||||||
const allFilters = flattenFilters( config.filters );
|
const allFilters = flattenFilters( config.filters );
|
||||||
value = value || query[ config.param ] || DEFAULT_FILTER;
|
value = value || query[ config.param ] || config.defaultValue || DEFAULT_FILTER;
|
||||||
return find( allFilters, { value } ) || {};
|
return find( allFilters, { value } ) || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,6 +255,10 @@ FilterPicker.propTypes = {
|
||||||
* The url paramter this filter will modify.
|
* The url paramter this filter will modify.
|
||||||
*/
|
*/
|
||||||
param: PropTypes.string.isRequired,
|
param: PropTypes.string.isRequired,
|
||||||
|
/**
|
||||||
|
* The default paramter value to use instead of 'all'.
|
||||||
|
*/
|
||||||
|
defaultValue: PropTypes.string,
|
||||||
/**
|
/**
|
||||||
* Determine if the filter should be shown. Supply a function with the query object as an argument returning a boolean.
|
* Determine if the filter should be shown. Supply a function with the query object as an argument returning a boolean.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue