Forum Stats

  • 3,873,344 Users
  • 2,266,537 Discussions
  • 7,911,514 Comments

Discussions

How to navigate to navigate to another jsff page and then execute a method

2»

Answers

  • dvohra21
    dvohra21 Member Posts: 14,691 Gold Crown

    Multiple .jsff fragments may be added to the same page. If relevant, any reason why multiple pages are used for .jsff fragments.

  • User_Q9C3J
    User_Q9C3J Member Posts: 20 Green Ribbon

    Timo, I figured out how to select a row. However, the problem is that when I select a row in my managed bean I believe this is before the page switch and when the table gets rendered on the page switch the view object gets queried again and the row I just selected gets cleared. It resets to the first row of the returned query.

  • dvohra21
    dvohra21 Member Posts: 14,691 Gold Crown

    The selected row may be set programmatically.

    //Obtain app module
    DCBindingContainer dcb = (DCBindingContainer) BindingContext.getCurrent().getBindingsEntry();
    ApplicationModuleImpl am = (ApplicationModuleImpl) dcb.getDataControl().getDataProvider();
    
    //Get your view
    ViewObjectImpl vo = am.getMyView1;
    

    Use vo.findByKey to lookup a row or simply iterate through every row if dataset is sufficiently small.

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,904 Red Diamond

    @User_Q9C3J Can you provide a reproducible test case? It would be easier to see what you are talking about and easier to help with one.


    Timo

  • User_Q9C3J
    User_Q9C3J Member Posts: 20 Green Ribbon
    Answer ✓

    I solved this.

    Basically I think the problem was that I was calling setCurrentRow() on the wrong instance of the view object. I accessed the right instance of the view object by doing this:

        BindingContext bc = BindingContext.getCurrent();

        DCBindingContainer container = bc.findBindingContainer("<page_def>");

        DCIteratorBinding it = container.findIteratorBinding("<iterator>");

    ViewObjectImpl vo = it.getViewObject();

    Change this to reflect your desired view object.

    I think the reason this wasn't working for me was that the iterator I was looking for wasn't in my getCurrentBindingsEntry() since it was on the page I was navigating to, so I had to manually look up the right binding container.