ADF: using popupFetchListener to execute a method before the popup opens

When developing ADF applications, a common way to create or update a record is doing it in a popup. There are many ways to do it that I have seen in some of my last ADF projects, for example:

  • Executing createInsert operation in the button’s action listener and then opening the popup programmatically 
  • Using an action listener to create the record and using showPopupBehavior with triggerType set to click (In this case, if the button is disabled on some condition, the actionListener will be executed anyway)

In this post I am going to show you another way, using popupFetchListener.

In this example we are going to drag and drop Departments view object as a table (we don’t really need it but we can see the new created record), and 2 buttons, one for creating records and other for editing them.

In each button we are going to add a showPopupBehavior component  with triggerType property set to action and popupId proerty set to the id of our popup.


Once we have the buttons, we create a popup and drag and drop departments view object as a form.
After that we have to create a popupFetchListener in the properties panel.

 This will create a method in our bean where we have to check the button we have clicked in order the call CreateInsert opeartion only when we click on Create button.

This is how the page definition file looks like. The tree binding, 4 fields of the form and the create insert operation that we call in the popupFetchListener.

The result of this implementation.

You can find the code of this post in Github.

You Might Also Like

7 Comments

  • Unknown

    August 17, 2016

    while creating it showing same data in popup it showing same data

    Replay
  • Unknown

    August 17, 2016

    i have problem in edit button bro

    Replay
  • Ruben Rodriguez

    August 17, 2016

    Can you check if contentDelivery property in the popup component is set to ladyUncached.

    I have uploaded the project into github.
    You can check the link in the post.

    regards,
    Ruben.

    Replay
  • Unknown

    August 18, 2016

    Thanks bro

    Replay
  • Unknown

    November 12, 2018

    Hi Rubin

    I have a problem that when i create Insert in pop up. As my requirement DepartmentId would be as lov.
    When i select departmentId, its corresponding name should be automatically populate in department name in textbox.
    After that commit all data from dialog's 'ok' button
    kindly suggest me how it will be possible.

    thanks

    Replay
  • Unknown

    November 12, 2018

    Dear Rubin

    I have a problem.
    when i clicked on create button the pop up shows then i create department id as list of values.
    when i select a department id, all filed should be automatically updated on the same pop up.
    and after that i click on ok button, values should be committed.
    Kindly provide a solution.

    Thanks

    Replay
  • Unknown

    November 12, 2018

    Dear Rubin

    i have a problem.
    When i click on create button and after that same pop up, select department id as list of values.

    When i select department id, department name should be populate in the department name input box in same pop up.

    After that when i click on submit button value should commit in the db.

    kindly provide a solution.
    Thanks

    Replay

Leave a Reply