Skip to Content
avatar image
Former Member

Search in TreeTable

Hi,

I have a tree within a table(Maaster Column) & i need to implement a search functionality such that a user gives his search criteria in a form & on click of button, the corresponding entry in table is displayed at the first row.

Can someone suggest me so as how to do this...??

Thanks & Regards,

Ankur

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 23, 2007 at 01:10 PM

    Hi.

    Create Context attribute FirstVisibleRow (integer) and bind corresponding property of the TreeTable to it.

    In Search eventhandler you may look up context node (to which is bound the TreeTable) to find the required element.

    Then calculate its index (look in the <a href="/people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii of Columns, p2</a> blog)

    Finnally, set the FirstVisibleRow attribute to that index.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      take a look here: /people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter

      Hope this help you.

      Bye,

      Vito

  • avatar image
    Former Member
    Jan 29, 2007 at 06:11 AM

    Hi all,

    I have implemented the search criteria in a simple table successfully.

    In case of a simple table I have recursively iterated through the elements & when relevant element is found, I have set the firstvisiblerow & leadselection to the index of that element.

    But in the case of tree table, I am facing problem while iterating through the elements & finding the relevant element.Here relevant element would be that for which text matches with the input given by user.

    Also, here I have to show the parent expanded, if a child is searched.

    If anyone can help me in solving this query.

    Thanks & regards,

    Ankur

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Dzmitry,

      Even i have gone through the idea of loading the treetable initially on page load. Then Search works very fine.

      But I have a concern over here.

      I have made a method Expand() & calling it in wdDoInit().But calling it in wdDoInit only expands one level hierarchy not lower than that.This is what i have written in wdDoInit():-

      //in wdDoInit for initially expanding

      if (!element.getLoaded()) {

      LoadChildData(element);

      element.setLoaded(true);

      }

      wdThis.Expand(wdContext.nodeOrgUnit(),true);

      // method Expand

      public void Expand( com.sap.test.tree.view.wdp.IPrivateTreeView.IOrgUnitNode node, boolean expand )

      {

      //@@begin Expand()

      if (node != null) {

      node.moveFirst();

      do{

      try {

      node.currentOrgUnitElement().setExpanded(expand);

      } catch (RuntimeException e) {

      e.printStackTrace();

      }

      wdThis.ExpandAll(node.nodeChildren(), expand);

      }while(node.moveNext() != null);

      }

      //@@end

      }