Home » Developer & Programmer » JDeveloper, Java & XML » Oracle ADF: Search on Tree Table is not working as expected
Oracle ADF: Search on Tree Table is not working as expected [message #554912] Fri, 18 May 2012 21:35
srinithan
Messages: 1
Registered: May 2012
Junior Member
Search on Table Tree View is not working as expected.

I'm working on a Table Tree View, and am facing some strange problem.

Lets say the Tree view is as follows. FetchSIze is 1000.

Case#1 Search Box: XA -> ENTER

A
XA
XB
XC
B

C

D


E

It works fine, it starts search from A and goes fine.

Case#2: Search Box: XA -> ENTER

If Search for same thing again, it starts search from B or C, not from A.

Code for the same:


CollectionModel model = (CollectionModel) tree1.getValue();
treeBinding = (JUCtrlHierBinding) model.getWrappedData();
JUCtrlHierNodeBinding root = treeBinding.getRootNodeBinding();

Found = false;
RowKeySet resultRowKeySet =
searchTreeNode(root, searchType, searchString);
RowKeySet disclosedRowKeySet =
buildDisclosedRowKeySet(treeBinding, resultRowKeySet);


tree1.setSelectedRowKeys(resultRowKeySet);
tree1.setDisclosedRowKeys(disclosedRowKeySet);

AdfFacesContext.getCurrentInstance().addPartialTarget(tree1);

private RowKeySet searchTreeNode(JUCtrlHierNodeBinding node,
String searchType,
String searchString) {

RowKeySetImpl rowKeys = new RowKeySetImpl();

if (Found == true) {
return rowKeys;
}

Row nodeRow = node.getRow();
if (nodeRow != null) {
String compareString = "";

Object attribute = nodeRow.getAttribute("ATTRIBUTENAME");
if (attribute instanceof String) {
compareString = (String)attribute;
} else {
compareString = attribute.toString();
}

if (compareString.equals(searchString) {

rowKeys.add(node.getKeyPath());
Found = true;
}
}

If (FOUND = false) {
List<JUCtrlHierNodeBinding> children = node.getChildren();

if (children != null ) {

for(JUCtrlHierNodeBinding _node: children) {
RowKeySet rks = searchTreeNode(_node, searchType, searchString);
if (rks != null && rks.size() > 0) {
rowKeys.addAll(rks);
}

}

}
}


return rowKeys;

}


Please suggest.
Previous Topic: split html content by tag
Next Topic: Adding new field to cater GL account code into Employee Self Service page (Expense Claim)
Goto Forum:
  


Current Time: Fri Dec 19 15:57:42 CST 2014

Total time taken to generate the page: 0.18815 seconds