Requirement- To get the current current node of tree table and get value of that node.
Solution- we will get the rowKeySet of the treetable.The using findNodeByKeyPath method , we will get the selected node.I already posted to get selected row of tree
RowKeySet selectedRows = treeTable.getSelectedRowKeys(); //use EL to access binding (note that you can do this in Java as well) JUCtrlHierBinding treeTableBinding = (JUCtrlHierBinding) executeValueExpression("#{bindings.<tree binding name>}"); //get first entry of selected rows (single selection case) JUCtrlHierNodeBinding node = treeTableBinding .findNodeByKeyPath((List)selectedRows .iterator().next()); ... do the work with the node here ... private Object executeValueExpression(String valueExpression){ FacesContext fctx = FacesContext.getCurrentInstance(); ELContext elctx = fctx.getELContext(); Application app = fctx.getApplication(); ExpressionFactory exprFactory = app.getExpressionFactory(); ValueExpression valueExpr = exprFactory.createValueExpression( elctx, valueExpression, Object.class); return valueExpr.getValue(elctx); }
Happy coding with Vinay Kumar in Techartifact