cancel
Showing results for 
Search instead for 
Did you mean: 

Backoffice: Applying Filter in sidebar resets addSearchDataConditions

Former Member
0 Kudos

When following the implementation guide "Initializing Advanced Search Widget with Multi Condition Queries" from https://help.hybris.com/6.6.0/hcd/058fa02799b4474d9adf96d564a19839.html and overriding public void addSearchDataConditions(AdvancedSearchData searchData) in the Order Fulfillment View of Backoffice the search conditions work as expected.

But these search conditions are reset as soon as a filter gets in the sidebar applied. (see screenshot)

Are there any possibilities to persist or reapply these search conditions?

 @Override
     public void addSearchDataConditions(AdvancedSearchData searchData)
     {
         if (searchData != null)
         {
             if (CollectionUtils.isNotEmpty(searchData.getConditions("shippingLabel")))
             {
                 searchData.getConditions("shippingLabel").clear();
             }
 
             if (CollectionUtils.isNotEmpty(searchData.getConditions("returnLabel")))
             {
                 searchData.getConditions("returnLabel").clear();
             }
 
             FieldType shippingLabelFieldType = new FieldType();
             shippingLabelFieldType.setDisabled(Boolean.FALSE);
             shippingLabelFieldType.setSelected(Boolean.TRUE);
             shippingLabelFieldType.setName("shippingLabel");
 
             FieldType returnLabelFieldType = new FieldType();
             returnLabelFieldType.setDisabled(Boolean.FALSE);
             returnLabelFieldType.setSelected(Boolean.TRUE);
             returnLabelFieldType.setName("returnLabel");
 
             List<SearchConditionData> labelConditionsList = new ArrayList<>();
 
             labelConditionsList.add(new SearchConditionData(shippingLabelFieldType, null, ValueComparisonOperator.IS_NOT_EMPTY));
             labelConditionsList.add(new SearchConditionData(returnLabelFieldType, null, ValueComparisonOperator.IS_NOT_EMPTY));
 
             SearchConditionDataList labelSearchConditionsList = SearchConditionDataList.and(labelConditionsList);
             searchData.addConditionList(ValueComparisonOperator.AND, Arrays.asList(labelSearchConditionsList));
         }
     }

Accepted Solutions (0)

Answers (0)