Tag Archives: pageload

Show dialog when a page is fully loaded


1. Add popup and outputText component at the end of your page (make sure popup is before outputText in the page structure)

2. Create bean binding for popup as well as outputText.

3. In the getter of outputText, launch popup programatically.

4. Set visible=false for outputText

Advertisements

Scroll to specific row in a table on pageload


Following code will help you to scroll to a specific row in a af:table on page load.

//Code to scroll to a specific row
this.tableBinding.setRowIndex(rowIndex);
RowKeySet ps = this.tableBinding.getSelectedRowKeys();
ps.clear();
ps.add(this.tableBinding.getRowKey());
AdfFacesContext.getCurrentInstance().addPartialTarget(this.tableBinding);

Also set the displayRow=selected for the table

How to invoke method before the page loads in ADF?


Here is the tutorial on how to invoke a method before the page loads in ADF. Let’s assume that you have a method in the application module, which will have to be invoked before the page load. For this, you have to expose this method as a client method using the client interface option for the application module. Click the edit icon and you will see your method listed in the Available list. Shuttle the method to Selected list and press ‘ok’. After shuttling the method you will see that the method gets added to the client interface. The method that we added will be exposed to the view layer through the application module data control. You have to refresh the data control to see your method. Now to get the binding for our method we have to add a method action binding to the page definition file and select the method that is exposed in the data control. We select our method from the Operation and click ‘ok’. After that we have to create an invokeAction in the Executables section to invoke the method action. We select our method from the list for the Binds and select Refresh as ‘always’.

now the method action binding and the invoke action is added to the page definition file.By default the invokeAction binding is added as a last executable. But we want to invoke the action on page load, so we move the invoke action to the first place to execute initially before any other executable. This can be done by dragging the invokeAction to the first place. Now whenever you run your page you will see the control goes to the method automatically.

download the sample project from this location