Skip to Content
author's profile photo Former Member
Former Member

Backoffice: Applying Filter in sidebar resets addSearchDataConditions

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));
         }
     }

filter backoffice

Add a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.