Clean criteria and Results in a af:query

Suppose we have two fragments, view1 and view2.

In view1 we have a button for go to the view2 and there we have a af:query with Table (the results).

If we need clean the criteria and the results when enter again in view2, one way is to insert a method call between the views and reset the criteria applied programmatically

cleanCriteria

public void reset(String myCriteria){
 //this code is in a ViewImpl context
 //myCriteria is the criteria that  use in af:query
 ViewCriteria _vcriteria = getViewCriteria(myCriteria);
 resetCriteria(_vcriteria);
 executeQuery();
}

FootNotes: Based on a question of the OTN Forum

Anuncios

Creating a handmade Search Form.

Although the af:query component is more and more customizable, sometimes we need a search form 100% handmade.

For this,we can drag a VO as form, and drag also the Find and Execute Operations.

By default the Form is show in editMode. The Find operation put the iterator in findMode, and now we can input values for search and Execute, execute the query of VO and turn off the findMode of the iterator.

This is how it was done in 10g, when not had af: query