Monday, May 2, 2011

How to hold the values in af:selectOneradio in the grid while filtering ?

In this thread i am going to share something about af:selectOneRadiovalues gets holding while filtering..
The usual scenario i faced is , there is a column in my grid called 'Status' having component af:selectOneRadio, when i filter in the grid after i selected the choice, the values selected gets unselected.
to solve this you have to use the entity based view. it wont work if you use read only view.


In the View Criteria there is a option called "Query executuion Mode",



If it is in 'database mode', whenever you enter a condition in the filter and execute the filter, a new database query is executed, VO's rowset is rebuilt and you lose the values entered in the transient attribute. To avoid recreation of the rowset (e.g. to avoid a new DB query execution) you should base the table's filter on an 'in memory mode' View Criteria instead of the default one (which is a "database" one).

If filter's View Criteria is an "in memory" one, the VO's rowset will not be rebuilt but the existing rowset will be filtered in memory and you will not lose the values entered in the transient attribute so far.

Note :
Have in mind the fact that marking the criteria as "in memory" will not filter the rows in the database query (which will be executed initially to load the rowset), so all the rows will be fetched and then they will be filtered in memory. If this is not desired (e.g. because the number of all the rows is large), you can combine the filter with an panel which will restrict the rows in the rowset and then the filter will filter them in memory.

If you are using the transient attribute, just derive it from entity to view.
If you are using the persistent attribute and you can just make change the execution mode.

I hope you have got some idea about execution mode purpose and the selectoneradio issue.

Regards,
Gopinath J

No comments:

Post a Comment