Forum Stats

  • 3,876,211 Users
  • 2,267,082 Discussions
  • 7,912,470 Comments

Discussions

How can I force a hard refresh (ctrl+F5)

Leandro Vitale
Leandro Vitale Member Posts: 39
edited Dec 2, 2016 12:04PM in JDeveloper and ADF

How i can force a hard refresh in main page (Ctrl + F5) when return of one Popup.

I use this code, but didn't worked

        BindingContainer bindings = getBindings();

        OperationBinding operationBinding = bindings.getOperationBinding("Execute");

        operationBinding.execute();

Any idea? I use JDeveloper 12c.

Best Answer

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,931 Red Diamond
    edited Dec 2, 2016 10:30AM Answer ✓

    This works fro me without writing on line of code. I start with the emp table in the HR db as

    pastedImage_0.png

    in my sample it looks like

    pastedImage_1.png

    as you see equal. Then I change the DB to 24000 and commit to get

    pastedImage_2.png

    Now I hit the refresh declarative button

    pastedImage_3.png

    and get

    pastedImage_4.png

    So I see the new or changes data in the db in my table

    All I did was to add a partialTrigger in the table pointing to the refreshButton!

    <af:table value="#{bindings.EmployeesView1.collectionModel}" var="row" rows="#{bindings.EmployeesView1.rangeSize}"                                      emptyText="#{bindings.EmployeesView1.viewable ? 'No data to display.' : 'Access Denied.'}" rowBandingInterval="0"                                      selectedRowKeys="#{bindings.EmployeesView1.collectionModel.selectedRow}"                                      selectionListener="#{bindings.EmployeesView1.collectionModel.makeCurrent}" rowSelection="single"                                      fetchSize="#{bindings.EmployeesView1.rangeSize}" filterModel="#{bindings.EmployeesView1Query.queryDescriptor}"                                      filterVisible="true" queryListener="#{bindings.EmployeesView1Query.processQuery}" varStatus="vs" id="t1"                                      partialTriggers="::b2">

    That's it.

    Timo

    Leandro Vitale

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,931 Red Diamond
    edited Dec 1, 2016 3:46PM

    User, can you describe what you try to archive. Executing an operation will just do that, executing it. If you want to refresh the UI you hae to issue a ppr. However, without more information it's hard to tell which way to go.

    Timo

  • Leandro Vitale
    Leandro Vitale Member Posts: 39
    edited Dec 2, 2016 6:07AM

    i will use the hard refresh because my information of the TreeTable don't refresh adequately and need use Ctrl + F5 to working and obtain information last updated

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,931 Red Diamond
    edited Dec 2, 2016 6:34AM

    Why does the info on hte tree table not refresh?

    Timo

  • PaKo
    PaKo Member Posts: 378
    edited Dec 2, 2016 7:23AM

    Beside data model, which is refreshed as per your code snippet, you should also refresh view component (or entire page, which you do with Ctrl+F5). As I dont know how you wish to "trigger" refresh, I'll assume you are doing it from some button. Lets say command / action button which triggers some action in backing bean (doing something in database) so you wish to show updated state in a table. Then you have just to put partialTrigger on your af:table to be the action button (or multiple of them, look into doc for partialTrigger property). Then, after the model is refreshed (as per executing binding action) JSF will rerender also the table view and - you get your data updated!

    Also, there is a way to grammatically force refresh of particular table from your code (instead using declarative partialTrigger approach). At the end of your code to refresh model, just add something like:

    private RichTable tableBinding;

    ...

    AdfFacesContext.getCurrentInstance().addPartialTarget(tableBinding);

  • Leandro Vitale
    Leandro Vitale Member Posts: 39
    edited Dec 2, 2016 7:24AM

    This is i don't know..

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,931 Red Diamond
    edited Dec 2, 2016 7:47AM

    Well, if xou don't describe youe whole use case and we can only guess. My guess is as @PaKo already told you that you have to send a ppr to the table or the surrounding layout container (e.g. af:panelCollection). If the change of hte data is invoked by a button, you can do this decoratively by adding the id of hte button to the Table or layout container. If you do t his you should use the Edit option you get if you click on the  wheel on the right side of the partial trigger property. This will ensure that you get the right id including any naming containers.

    Timo

  • Leandro Vitale
    Leandro Vitale Member Posts: 39
    edited Dec 2, 2016 9:59AM

    For example, I run the application that shows me a table in the database. If I modify this database physically, when refreshing the page do not see the changes reflected, I need to close the application and re-run. Is the information cached?

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,931 Red Diamond
    edited Dec 2, 2016 10:30AM Answer ✓

    This works fro me without writing on line of code. I start with the emp table in the HR db as

    pastedImage_0.png

    in my sample it looks like

    pastedImage_1.png

    as you see equal. Then I change the DB to 24000 and commit to get

    pastedImage_2.png

    Now I hit the refresh declarative button

    pastedImage_3.png

    and get

    pastedImage_4.png

    So I see the new or changes data in the db in my table

    All I did was to add a partialTrigger in the table pointing to the refreshButton!

    <af:table value="#{bindings.EmployeesView1.collectionModel}" var="row" rows="#{bindings.EmployeesView1.rangeSize}"                                      emptyText="#{bindings.EmployeesView1.viewable ? 'No data to display.' : 'Access Denied.'}" rowBandingInterval="0"                                      selectedRowKeys="#{bindings.EmployeesView1.collectionModel.selectedRow}"                                      selectionListener="#{bindings.EmployeesView1.collectionModel.makeCurrent}" rowSelection="single"                                      fetchSize="#{bindings.EmployeesView1.rangeSize}" filterModel="#{bindings.EmployeesView1Query.queryDescriptor}"                                      filterVisible="true" queryListener="#{bindings.EmployeesView1Query.processQuery}" varStatus="vs" id="t1"                                      partialTriggers="::b2">

    That's it.

    Timo

    Leandro Vitale
  • Leandro Vitale
    Leandro Vitale Member Posts: 39
    edited Dec 2, 2016 12:04PM

    Thanks, is the solution

This discussion has been closed.