Forum Stats

  • 3,782,457 Users
  • 2,254,650 Discussions
  • 7,880,082 Comments

Discussions

Resetting a specific component using ResetUtils.reset(), causes an every field reset

AkilThar
AkilThar Member Posts: 38 Red Ribbon

I have parent child relationship Client and Addresses.

In the UI, I have a af:panelFormLayout for Client inputs and <af:table id="t1"> for addresses. When I soft delete an address using a af:commandButton, a partial refresh happens without an issue.

But I wanted to do a partial reset to the address table when the Address deletion happens. So I defined a bean method and called it in the button.

  public void ResetInputs(ActionEvent ae) {

    oracle.adf.view.rich.util.ResetUtils.reset(getT1());

  }

actionListener="#{testBeanScope.backing_clientEdit.ResetInputs}

But in runtime the function resets even the newly changed Client data inside the panelform.

Best Answer

  • AkilThar
    AkilThar Member Posts: 38 Red Ribbon
    edited Oct 11, 2020 3:47PM Accepted Answer

    @Timo Hahn Thanks a ton for your help and quick responses.

    I was able to fix this issue by resetting the required input fields manually one by one.

    public void ResetInputs(ActionEvent ae) {

         RichInputText input = (RichInputText)JSFUtils.findComponentInRoot(id); 

         input.setSubmittedValue(null); 

         input.resetValue();

      }

    The inbuilt,

    oracle.adf.view.rich.util.ResetUtils.reset(getT1());

    method does a full page input field reset, which is the same functionality as <af:resetActionListener/> 

    So it was not useful in my case.

Answers

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

    User, tell us your exact JDev version, please!

    When I soft delete an address using a af:commandButton, a partial refresh happens without an issue.

    But I wanted to do a partial reset to the address table when the Address deletion happens. So I defined a bean method and called it in the button.

    Can you show some images of what you mean by this?

    Is the table in edit mode?

    Can you post the page code?

    Are the iterators on the page in change event mode ppr?

    This can cause other components (related to the table) to be refreched too.


    Timo

  • AkilThar
    AkilThar Member Posts: 38 Red Ribbon

    Thanks @Timo Hahn

    This is a sample image of the setup. (Department = Client, Employees = Addresses)

    Yes. The table is in the edit mode.

    If I explain the scenario (without the reset function) according to this sample image,

    1. I change the Department name.
    2. Click 'Delete' button in the 'Employees' tab.
    3. A ppr happens (only the table is refreshed), employee row deleted. The new changed department name is kept.
    4. I click 'Save' and commit the changes

    But when I add the mentioned reset function.

    at step 3, employee row deleted, but the changed department name is reset to the previous one. The department name shouldn't be reset, because I only reset the table (t1) in the reset function.

    I have limitations posting the actual code and images. Sorry about that.

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

    And your JDev version is?


    Can you describe the use case, please?

    What do you try to reset?


    Timo

  • AkilThar
    AkilThar Member Posts: 38 Red Ribbon

    @Timo Hahn

    JDev version is 12.2.1.4.0

    The main reason for the reset is,

    When an address is deleted and trying to add a new address, the deleted bank information are not properly cleared from the input fields (I found this is a kind of a typical issue in ADF). 

    That's why the reset needed. Using of the af:resetListener, fixes this issue. But it reset all the inputs of the page. That's why I'm going for a more of a custom reset method, where I have more control on the resetting and I can reset the inputs of a specific component.

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

    Do you mean that when you delete a row, the row is not deleted?

    This works in my applications.


    Anyway, if you delete a row, the input fields are gone, but I might be wrong as I rarely work with editable tables.

    I'll try to test this.


    An interesting read is https://www.ateam-oracle.com/a-hidden-gem-of-adf-faces-12c-the-aftarget-tag


    Timo

  • AkilThar
    AkilThar Member Posts: 38 Red Ribbon
    edited Oct 11, 2020 7:10AM

    @Timo Hahn

    Thanks.

    This is the exact issue of me, I found this in lots of places on the web. But this fix refreshes and reset the whole page in my case.

    https://vtkrishn.com/2012/08/18/how-to-in-jdeveloper-tutorials-adf-reset-the-inputtext-component-values/
    
    
    
  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,782 Red Diamond

    Do you have a reproducible test case I can use to look into this?

    This would help to save some of my time.


    Timo

  • AkilThar
    AkilThar Member Posts: 38 Red Ribbon
    edited Oct 11, 2020 3:47PM Accepted Answer

    @Timo Hahn Thanks a ton for your help and quick responses.

    I was able to fix this issue by resetting the required input fields manually one by one.

    public void ResetInputs(ActionEvent ae) {

         RichInputText input = (RichInputText)JSFUtils.findComponentInRoot(id); 

         input.setSubmittedValue(null); 

         input.resetValue();

      }

    The inbuilt,

    oracle.adf.view.rich.util.ResetUtils.reset(getT1());

    method does a full page input field reset, which is the same functionality as <af:resetActionListener/> 

    So it was not useful in my case.