- $.each( paramRepresentation, function ( paramName, paramValue ) {
- var filterItem = paramToFilterMap[ paramName ];
-
- // Flip the definition between the parameter
- // state and the filter state
- // This is what the 'toggleSelected' value of the filter is
- result[ filterItem.getName() ] = areAnySelected ?
- !Number( paramValue ) :
- // Otherwise, there are no selected items in the
- // group, which means the state is false
- false;
+ $.each( expandedParams, function ( paramName, paramValue ) {
+ var value = paramValue,
+ filterItem = paramToFilterMap[ paramName ];
+
+ if ( model.getType() === 'send_unselected_if_any' ) {
+ // Flip the definition between the parameter
+ // state and the filter state
+ // This is what the 'toggleSelected' value of the filter is
+ result[ filterItem.getName() ] = areAnySelected ?
+ !Number( paramValue ) :
+ // Otherwise, there are no selected items in the
+ // group, which means the state is false
+ false;
+ } else if ( model.getType() === 'boolean' ) {
+ // Straight-forward definition of state
+ if (
+ filterItem.isUsingDefaultAsBaseValue() &&
+ paramRepresentation[ filterItem.getParamName() ] === undefined
+ ) {
+ value = defaultParams[ filterItem.getParamName() ];
+ }
+ result[ filterItem.getName() ] = !!Number( value );
+ }