Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hello,
for one of my customers I've created a wizard step with some change validation info.
the data is arranged in a flat tree structure which is displayed in the treetable component.
See attached example screenshot.
One requirement is that non "green" checks are auto expanded for the user.
I tried to implement it as described in the customizers guide, but so far no luck.
The TreeTable component uses a custom AbstractConfigurableTableBuilder with an custom ExpansionStateManager
the table config looks like this
JcaTreeConfig treeCfg = (JcaTreeConfig) factory.newTreeConfig();
treeCfg.setDataSourceMode(DataSourceMode.DISABLED);
treeCfg.setType(Object.class.getName());
treeCfg.setTargetObject("origObject");
treeCfg.setComponentMode(ComponentMode.VIEW);
treeCfg.setActionModel("tcw tcwValidation table");
//treeCfg.setMenubarName("tcw tcwValidation table");
treeCfg.setId(TCW_TCWVALIDATION_TABLE_ID);
treeCfg.setLabel(WTMessage.getLocalizedMessage(TCW_RESOURCE, "tcw.validationTable.title", (Object[]) null, SessionHelper.getLocale()));
treeCfg.setNodeColumn(TCW_VAL_COLID_VALTYPE);
treeCfg.setShowTreeLines(true);
treeCfg.setExpansionLevel(DescriptorConstants.TableTreeProperties.FULL_EXPAND);
treeCfg.setFindInTableEnabled(false);
treeCfg.setFindInTableMode(FindInTableMode.DISABLED);
treeCfg.setShowCount(true);
treeCfg.setDisableAction("false");
treeCfg.setRowBasedObjectHandle(true);
addColumn(TCW_VAL_COLID_VALTYPE, treeCfg, factory, true, false, false);
addColumn(TCW_VAL_COLID_CHECKTYPE, treeCfg, factory, true, false, false);
addColumn(TCW_VAL_COLID_MESSAGE, treeCfg, factory, true, false, false);
addColumn(TCW_VAL_COLID_RESULTTYPE, treeCfg, factory, true, false, false);
if (isTCWWizardMode) {
addColumn(TCW_VAL_COLID_ACTION, treeCfg, factory, true, false, false);
addColumn(TCW_VAL_COLID_RELATEDOBJ, treeCfg, factory, true, false, false);
}
the root nodes list is build like this
List rootNodes = new ArrayList();
for (TCWValidationCheckType t : topChecks) {
TCWValidationBean rowBean = new TCWValidationBean(t);
rowBean.setModelContext(modelContext);
rowBean.setHasChildren(true);
rowBean.setDepth(1);
if ("INFO".equals(t.getCheckResult())) {
if (!"hideAllGreen".equals(resultFilter)) {
addExpandedNode(rowBean);
rootNodes.add(rowBean);
}
} else if (!"SUCCESS".equals(t.getCheckResult())) {
// check is not ok, add to auto expand list
addExpandedNode(rowBean);
rootNodes.add(rowBean);
} else {
if (!"hideAllGreen".equals(resultFilter)) {
rootNodes.add(rowBean);
}
}
}
if (rootNodes.isEmpty()) {
// add entry "all successfull"
String x = WTMessage.getLocalizedMessage(TCW_RESOURCE,"tcw.validation.summarymessage.allchecksok", (Object[]) null, SessionHelper.getLocale());
TCWValidationBean rowBean = new TCWValidationBean(x);
rootNodes.add(rowBean);
addExpandedNode(rowBean);
}
the overriden method isExpandNeeded looks like this
@Override
public boolean isExpandNeeded(Object beanObjIn, int level) throws WTException {
boolean expandNeeded = false;
if (beanObjIn instanceof TCWValidationBean) {
TCWValidationBean tcwValBean = (TCWValidationBean) beanObjIn;
if (this.getExpandedOids() != null && tcwValBean.getOid() != null && this.getExpandedOids().contains(tcwValBean.getOid().toString())) {
expandNeeded = true;
}
}
return expandNeeded;
}
setting the root nodes for expand & setting everything to expand_full seems to have no effect.
there are no errors or hints in the log unfortunately.
manual by the user "expand" works without a problem.
any suggestions maybe? what did I forget/miss? 😉
THANKS!
Hi @PN_5076692
I've never found a way how to expand the tree automatically by API.
As you've mentioned the expand_full really does not work at all.
I usually add an action expand all for user to the table menu.
PetrH