cancel
Showing results for 
Search instead for 
Did you mean: 

How to display relational attribute in list view of Backoffice?

0 Kudos
1,904

I have two items, ItemA and ItemB and there is one to many relation between them. I have a requirement to display the attribute of ItemB in ItemA.

       <itemtype code="ItemA"
             jaloclass="com.xyz.core.staff.jalo.StaffInformation">
             <deployment table="staffinformation" typecode="20707" />
             <attributes>
                 <attribute type="java.lang.String" qualifier="name">
                     <modifiers optional="false" />
                     <persistence type="property" />
                 </attribute>
             </attributes>
         </itemtype>    

      <itemtype code="ItemB" extends="AbstractContactDetails"
             jaloclass="com.xyz.core.contact.jalo.EContactInfo">
             <attributes>            
                 <attribute type="java.lang.String" qualifier="emailAddress">
                     <modifiers unique="true" />
                     <persistence type="property" />
                 </attribute>
             </attributes>
         </itemtype>
 
        <relation code="ItemAToItemB" autocreate="true"
         generate="false" localized="false">
         <sourceElement qualifier="itemA" type="ItemA"
             cardinality="one">
             <modifiers />
         </sourceElement>
         <targetElement qualifier="itemB" type="ItemB"
             cardinality="many">
             <modifiers partof="true" />
         </targetElement>
 </relation>

So i need to display emailAddress in list view of ItemA

I tried accessing attribute through qualifier of targetElement i.e itemB.emailAddress and also tried giving base config for ItemB.

But it didnt worked. Please Suggest

Thanks,

View Entire Topic
Former Member
0 Kudos

Hi All, If you want to fetch the value from other type other than the context one then, you may have to write renderer class to fetch the value of that attribute. For instance in above code you have to write one java class which implements WidgetComponentRenderer and the spring name can be used to define that


  <list:list-view xmlns:list="http://www.hybris.com/cockpitng/component/listView">
          <list:column qualifier="name">
          <list:column qualifier="emailAddress" spring-bean="emailAddressRenderer"  label="Email Address" />    
      </list:list-view>
  </context>

sumit_rajan
Associate
Associate
0 Kudos

Great Hamid