- 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 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.