cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Backoffice StandardDateRange in advanced- and simple-search

voiv
Explorer
0 Kudos
912

Hi,

My Type Foo contains a field "dates" of Type List<StandardDateRange> (de.hybris.platform.util.StandardDateRange).

Now i would like to add this field to the Backoffice advanced-search with this configuration:

<context type="Foo" component="advanced-search">
  <as:advanced-search connection-operator="AND">
    <as:field-list>
      <as:field name="dates" operator="contains" selected="true"/>
    </as:field-list>
  </as:advanced-search>
</context>


But the field doesn't appear:

I also would like to make the same field sortable in the List-View int the collection-browser.

How do I add the field to the advanced-search?

Is it possible and recommendable to make the "dates" field sortable in the List-View of the collection-browser?

Kindest regards

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi Ivo,

Sorry for my delay response.

Basically I didn't get the idea of having a List<StandardDateRange>, probably your case is require different approach. However, here is what I've got for you. Hope will help at least to get some idea from the configuration below.

Other than that if you give more details maybe I can think for a different approach.

*-items.xml

<itemtype code="Foo" autocreate="true" generate="true" extends="Product">
<attributes>
<attribute qualifier="dateRange" type="de.hybris.platform.util.StandardDateRange">
<description>date range the trigger is active</description>
<modifiers read="true" write="true" initial="false" optional="true"/>
<persistence type="property"/>
</attribute>
</attributes>
</itemtype>

*backoffice-config.xml

<context type="Foo" component="advanced-search" merge-by="type" parent="Product">
<as:advanced-search xmlns:as="http://www.hybris.com/cockpitng/config/advancedsearch" connection-operator="AND">
<as:field-list>
<as:field name="dateRange" operator="contains" selected="true" sortable="true"/>
</as:field-list>
</as:advanced-search>
</context>
<context type="Foo" component="listview" merge-by="type">
<list-view:list-view>
<list-view:column link="true" position="3" qualifier="dateRange" hflex="true" label="DateRannge" spring-bean=""/>
</list-view:list-view>
</context>

in the listview tag if you want to have a better rendering you need to define a spring-bean="theIdOfYourRenderer"

Other then that the field is sortable and it's displayed in the search and list view.

Hope this helps.

Best Regards,

0 Kudos

Forgot to attach the screenshot for you.

0 Kudos

Hi Ivo,

Taking the example that you posted I've encountered the following.

It was missing xmlns:as="http://www.hybris.com/cockpitng/config/advancedsearch" in the <as:advanced-search> tag. Also it was missing merge-by attribute.

<context type="Foo" component="advanced-search"  merge-by="type">
<as:advanced-search xmlns:as="http://www.hybris.com/cockpitng/config/advancedsearch" connection-operator="AND">
<as:field-list>
<as:field name="dates" operator="contains" selected="true"/>
</as:field-list>
</as:advanced-search>
</context>
voiv
Explorer
0 Kudos

Hi,

Sorry I forgot to mention that we have the "as" definition in a separat config block.

I think the problem is more the Datatype of the field "dates" instead of the config for the advanced-search because if I add another field to the advanced-search (e.g. "id") the id-filed works perfectly fine, but the "dates"-field won't appear.

And adding a merge-mode doesn't work either, the "dates"-field won't be displayed.

Thanks for your Help.