Hello @all,
I have the following context structure
root
--category
-- --report
-- -- --id
-- -- --name
-- --id
-- --name
the parent node is "category" with attributes "id" and "name" and the child node is "report" with "id" and "name".
Now I want on an onAction-Event of a Button, that for every category an itemListBox will be created with the according report names. the creation of the itemList is not the problem, but the binding of the datasource and/or the descriptivetext.
my code:
public void initItemListBox( )
{
//@@begin initItemListBox()
IWDView view = wdContext.currentContextElement().getSelectView();
IWDGroup group = (IWDGroup) view.getElement("ItemListGroup");
if (group.hasChildren())
{
group.removeAllChildren();
}
for (int i = 0; i < wdContext.nodeCategory().size(); i++)
{
ICategoryElement catEl = wdContext.nodeCategory().getCategoryElementAt(i);
wdContext.nodeCategory().setLeadSelection(i);
generateItemLists(wdContext.currentContextElement().getSelectView(), wdContext, catEl);
}
//@@end
}
public void generateItemLists( com.sap.tc.webdynpro.progmodel.api.IWDView view, de.mgi.portaldev.bc.mdw.msi.wdp.IPrivateCRSReportView.IContextNode wdContext, de.mgi.portaldev.bc.mdw.msi.wdp.IPrivateCRSReportView.ICategoryElement category )
{
//@@begin generateItemLists()
// ItemListBox
IWDGroup group;
IWDGroup catGroup;
IWDLabel label;
String groupId = "group_" + category.getName();
catGroup = (IWDGroup) view.createElement(IWDGroup.class, groupId);
IWDMatrixLayout matrLayout = (IWDMatrixLayout) catGroup.createLayout(IWDMatrixLayout.class);
String labelId = "label_" + category.getName();
label = (IWDLabel) view.createElement(IWDLabel.class, labelId);
label.setText(category.getName());
IWDMatrixData layout = (IWDMatrixData) label.createLayoutData(IWDMatrixData.class);
layout.setVAlign(WDCellVAlign.TOP);
String itemListId = "itemList_" + category.getName();
IWDItemListBox itemListBox = (IWDItemListBox) view.createElement(IWDItemListBox.class, itemListId);
label.setLabelFor(itemListId);
IWDMatrixData itemlayout = (IWDMatrixData) itemListBox.createLayoutData(IWDMatrixData.class);
itemListBox.bindDescriptiveText("crsReporting.category.report.name");
IWDNodeInfo reportNodeInfo = category.nodeReport().getNodeInfo();
// itemListBox.bindText(reportNodeInfo.getAttribute("name"));
itemListBox.setVisibleItems(5);
IWDMatrixHeadData matrixHead = (IWDMatrixHeadData) itemListBox.createLayoutData(IWDMatrixHeadData.class);
IWDAction itemListAct = (IWDAction) wdThis.wdGetItemSelectAction();
itemListBox.setOnLeadSelect(itemListAct);
// itemListBox.bindDataSource(reportNodeInfo);
itemListBox.bindDataSource("crsReporting.category.report");
catGroup.addChild(label);
catGroup.addChild(itemListBox);
group = (IWDGroup) view.getElement("ItemListGroup");
group.addChild(catGroup);
// END ITEMLIST
//@@end
}
What am I doing wrong? in every ItemListbox there are only the report names of the last category.
thanks.