0

I am working on search functionality on GWT CellTree.

I have a cellTree with 4 levels. Namely, Root->Session->Uproc->Batch.

What I need to do is, when I get the searched node from the DB along with its parent, I need to expand its parent and highlight the node.

I am able to expand the parent node but how do I highlight the searched node?

Please help me solve this issue.

Hardik Mishra
  • 14,779
  • 9
  • 61
  • 96

2 Answers2

0

The easiest is to select the object in your SelectionModel.

If that's not what you want, and you only want some other kind of highlighting, it gets tricky: you have to somehow communicate to your Cell that the specific value has to be drawn with an highlighted state, and then have the cell redrawn.
The first part depends on how you architectured your code; for the second part, you have to get a handle on the TreeViewModel.NodeInfo instance (or if you used a TreeViewModel.DefaultNodeInfo, on its AbstractDataProvider) for the parent of the highlighted node, so that you can trigger a redraw of the children list (where the highlighted item is). It again depends how you did it exactly, but you have to somehow make a call to the HasData's (representing the list o children) setRowData, passing it the exact same data as is already displayed (but it's enough to trigger a redraw, so that the Cell will generate the highlighted state for the item).

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
-1

You can try this:

You can highlight searched node by giving it css. Here is the css:

.selected_tree_node {
    font-weight:  bold;
}

Apply this css to your node:

yourNode.setStyleName("selected_tree_node");
JankiPanwala
  • 584
  • 1
  • 4
  • 20