Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Grid masterDetail 'expand all' Functionality - Possible in JSF version?
posted

We are in _desparate_ need of a way to implement an 'expand all' function for grids with masterDetail facets.

We don't have any multi-layer nestings... just a single layer.  How can we solve this problem?

Is there a way to do this with a bit of custom Javascript (which I'm not afraid of)?  I've tried a few things, but calling some of the same Javascript functions in [seemingly] the exact same way as the stock implementation doesn't work as I would expect.

The particular scenario where this is most needed won't typically see more than 4 or 5 rows in the parent grid, so we'd only need to expand that many rows.  I can see where if there were several dozen (or hundred) rows, there'd be a significant performance hit from all the AJAX calls/traffic.

Is there a way to set the rows expanded in the Java on a GridView object, maybe?  Anything...?

PLEASE HELP!

Parents
  • 1324
    posted

    Hello,

    There is no need to do lot of stuff using java script to expand the rows. You can expand all the rows easily by iterating all the rows fetching from grid object. Following is the code snippets to expand all the rows using java code on command button click:

    In JSP:
    <h:commandButton actionListener="#{Bean.onClick}" value="Expand"></h:commandButton>

     

     

    In Java:

    public void onClick(ActionEvent event)
    {
    Iterator AllGridRows = grid.getRows().iterator();
    RowItem currentRowItem = null;
    while(AllGridRows.hasNext()){
    currentRowItem=(RowItem) AllGridRows.next();
    currentRowItem.setExpanded(true);
    }
    }

    Hope it helps.

    Roshan

Reply Children