Thursday, 20 June 2013

ADF : Refresh issues in Oracle ADF Application

During the application development in ADF, the most common problem that we encounter when our application is deployed on server is the problem of refresh. That means you expect a component to refresh on some action but still it doesn't happens.

This problem comes into picture in a big size application that uses many other applications or many taskflows are being called into it.I dont exaclty know why this problem comes into focus, but its some kind of 'id' problem of UIcomponent. 

So, here are some of the solution if the above problem comes into picture.


  1. The easiest way to give partial trigger to a UIComponent is to go into the properties menu in the property inspector and simply choose the component id you want to select. So whenever the selected UIcomponents will have a change, the UIComponent on which partial refresh is given is refreshed.



     
  2. Sometimes it happens that even after giving partial trigger on the UIComponent the Component is not been refreshed.So, you can try to refresh the component from the bean using java code.
    AdfFacesContext.getCurrentInstance().addPartialTarget(UIComponent);


    Here 'UIComponent' is the binding of the UIComponent on the page into the bean.
  3. Sometimes the above two methods fail.After using the above two techniques also the field is not being refreshed. Then you can use the ResetUtil class for resetting the fields.

    For using ResetUtil you have to import the given class:
    import oracle.adf.view.rich.util.ResetUtils;
    

    And to use it on the page :

    ResetUtils.reset(UIComponent); 
      
  4. After using the above methods if Still the problem exists. Then if you are using model in your application, then you have to perform "execute" on the used ViewObject.
  5. Still if the problem persists, then perform "Rollback" after the "Commit" operation.
  6. Still if the problem exists, please drop your case in the comment box.. :) 

Wednesday, 19 June 2013

ADF : Disable and Enable TableSelectionListener

Some times in the development we need to enable or disable the table so that the user is not able to make row selection from the table.
Suppose there is a case in which a row selected in the table is in edit mode in a form, and you don't want to allow the user to select any other row during the edit operation. So for this purpose you need to disable the table selection.
You can use the following code for doing so :



tableBinding.setRowSelection(RichTable.ROW_SELECTION_NONE);

Here :
  1.  "tableBinding" is the binding of table in the bean. 
And after your work when you want to again enable the rowSelection. You can use it as follows :
tableBinding.setRowSelection(RichTable.ROW_SELECTION_SINGLE);