Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Tree grid - Have all records from root to leaf

    Hello,

    With treegrid widget we can have the selected record or the selected path wich is a string.

    How can I have all records from root node to selected leaf node (SelectionType.Single) ?

    #2
    I found the solution :

    Code:
    ArrayList<ListGridRecord> listrec = new ArrayList<ListGridRecord>() ;
    
    ListGridRecord lgrec = getAvailableModule().getSelectedRecord();
    listrec.add(lgrec);
    String end = lgrec.getAttribute("CATEGORY_ID");
    while (!lgrec.getAttribute("PARENT_ID").equals(end)){
    	for (ListGridRecord rec : getAvailableModule().getRecords()){
    							
    	     if (rec.getAttribute("ID").equals(lgrec.getAttribute("PARENT_ID"))){
    								listrec.add(rec);
    								lgrec = rec;
    	     }
    	}
    }
    getAvailableModule() Is my treeGrid

    But is no method to do that automatically ? For performance

    Comment

    Working...
    X