cancel
Showing results for 
Search instead for 
Did you mean: 

Next Generation Cockipit 6.0 extending UI layout

Former Member
0 Kudos

As of 6.0 you added a dashboardConditionEvaluator which "selects" either the dashboard layout or the collection browser. If I wanted to change the layout based on the id of the node(display a different widget than collection browser). How would I be able to accomplish that? I used a property extractor from the node to get the id and then connect the extractor to the backoffice_content_container selectPerspectiveById socket. However this of course would mean that the process is going to happen twice. First for the collectionBrowser and then for my custom widget.

In the end it does what i want but it produces some overhead. Is there another way?

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Found a better solution: for changing the displayed widget when clicking on an explorer node, not sure if it is the best. You basically have to add a condition evaluators for each of your custom perspectives and a default one that selects the collection browser.

    <widget id="addToCartPropertyExtractor" widgetDefinitionId="com.hybris.cockpitng.widgets.common.propextractor" slotId="cockpitWidgetChildrenInvisible" template="false">
       <setting key="expression" type="String">id</setting>
       <virtual-sockets/>
     </widget>
 
     <widget id="addToCart" widgetDefinitionId="org.my.extension.presentationWidget" slotId="perspectives"
             title="Add To Cart" template="true">
       <widget id="resultSet" widgetDefinitionId="com.hybris.cockpitng.collectionBrowser"
               slotId="productList"
               title="ResultList" template="false">
       </widget>
     </widget>
 
     <widget id="addToCartConditionEvaluator" widgetDefinitionId="com.hybris.cockpitng.conditionevaluator" slotId="cockpitWidgetChildrenInvisible" template="false">
       <setting key="expression" type="String">#root.id EQ 'addToCart'</setting>
     </widget>
 
     <widget id="defaultEvaluator" widgetDefinitionId="com.hybris.cockpitng.conditionevaluator" slotId="cockpitWidgetChildrenInvisible" template="false">
       <setting key="expression" type="String">#root.id NE 'addToCart' AND #root.id NE 'backoffice_dashboard'</setting>
 
       <widget id="collapsePropertyExtractor" widgetDefinitionId="com.hybris.cockpitng.widgets.common.propextractor" slotId="cockpitWidgetChildrenInvisible" template="false">
         <setting key="expression" type="String">'collapsibleContainer'</setting>
       </widget>
 
     </widget>
 
   </widget-extension>
 
   <widget-extension widgetId="dashboardConditionEvaluator">
     <remove widgetId="nonDashboardPropertyExtractor"/>
   </widget-extension>
 
   <widget-connection sourceWidgetId="addToCart" outputId="searchResults"
                      targetWidgetId="resultSet" inputId="pageable"/>
 
   <widget-connection sourceWidgetId="resultSet" outputId="selectedItem"
                      targetWidgetId="addToCart" inputId="selectedProduct"/>
 
 
   <widget-connection sourceWidgetId="explorerTree" outputId="nodeSelected" targetWidgetId="addToCartConditionEvaluator" inputId="input"/>
   <widget-connection sourceWidgetId="explorerTree" outputId="nodeSelected" targetWidgetId="defaultEvaluator" inputId="input"/>
   <widget-connection sourceWidgetId="addToCartConditionEvaluator" outputId="true" targetWidgetId="addToCartPropertyExtractor" inputId="genericInput"/>
   <widget-connection sourceWidgetId="addToCartPropertyExtractor" outputId="genericOutput" targetWidgetId="backoffice_content_container" inputId="selectPerspectiveById"/>
 
   <widget-connection sourceWidgetId="defaultEvaluator" outputId="true" targetWidgetId="collapsePropertyExtractor" inputId="genericInput"/>
   <widget-connection sourceWidgetId="collapsePropertyExtractor" outputId="genericOutput" targetWidgetId="backoffice_content_container" inputId="selectPerspectiveById"/>
 



Answers (0)