Hi,
I am trying to use a Hierarchy viewer with programmatic View objects. In my application I cannot connect to the database directly using read only view objects, so I have used programmatic view objects and am populating the VOs at runtime by making call to a host service which returns the data.
I have created two programmatic VOs:
ProductGrpVO {PRODUCT_GROUP_CODE, PRODUCT_GROUP_DESC} (Source VO),
ProductVO {PRODUCT_GROUP_CODE, PRODUCT_CODE, PRODUCT_DESC} (Destination VO)
Further I have created a view link to connect the above VOs based on common value PRODUCT_GROUP_CODE
GrpToPrdViewLink
I have drag-dropped the data control for the created view link (which is an instance of the source view object in AppModule and contains my destination view object as its child) to my jsff page to create the hierarchy viewer. My jsff page also contains a LOV for product group code, based on which I'm making the host call to populate related data for the selected product group code.
Once the data is returned from host, I populate the source and destination VOs setting the PRODUCT_GROUP_CODE in both VOs with same value.
Code used is as below, as of now I've hard coded the values:
Row prodGrpRow = this.productGroupHierarchyVO.createRow();
prodGrpRow.setAttribute("PRODUCT_GROUP_CODE", "PRDGRP1");
prodGrpRow.setAttribute("PROD_GROUP_DESC", "Product Group 1");
/* Retrieve child VO and set attributes */
RowSet items = (RowSet)prodGrpRow.getAttribute("ProductVO");
Row r1 = items.createRow();
r1.setAttribute("PRODUCT_CODE", "PRD1");
r1.setAttribute("PRODUCT_DESC", "Product One");
r1.setAttribute("PRODUCT_GROUP_CODE", "PRDGRP1");
items.insertRowAtRangeIndex(0, r1);
this.productGroupHierarchyVO.insertRowAtRangeIndex(0, prodGrpRow);
The common attribute in both the VOs is having the same value and same data type. When the hierarchy viewer is rendered on the screen, the first level of the hierarchy is visible i.e. the rows in parent view object) but the related children are not rendered on the screen, even on the click of the + button below the node.
The same works if VOs are created based on read only queries, but that approach cannot be used in our application.
Regards,
Amit Wagle