Sorting a Transient ViewObject
Transient ViewObject is a value holder for non persistable data. In this post I'm sharing a very simple example illustrating the built in sorting support for a transient ViewObject. Please note that if you have table built using a transient ViewObject, a click on the sort icon for a column in turn would invoke ViewObjectImpl::setSortBy(String sortBy) to perform in memory sorting. Whereas for a non transient VO, sorting is done by setting the OrderByClause using ViewObjectImpl::setOrderByClause(String orderByClause). This example is built based on the above theory :). I'm populating the the rows programmatically from the overridden ViewObjectImpl::executeQueryForCollection(...) and the rest is taken care by the framework. Please see Fusion Developers Guide to know the key framework methods to override for programmatic View Objects
You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]
How to run this sample?
Run the main.jspx and try sorting the table columns.
You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]
How to run this sample?
Run the main.jspx and try sorting the table columns.
Thanks for the example, it is a helpful information when you work with programatic VO.
ReplyDeleteHi Jobesh, thanks for sharing such a very useful information
ReplyDeleteI tried implementing same way, but instead of hard coding rows, I have populated rows programatically by calling some other service,
ReplyDeleteI have overridden below methods
create()
executeQueryForCollection() - In this I am calling getRowCount() to get value for 'rows'
- I am always getting '0' for getRowCount() .. Any idea why?
try calling getEstimatedRowcount()
ReplyDeleteThanks for reply,
ReplyDeleteI tried estimatedRowCount() , but still getting zero.
Thanks
Hi,
ReplyDeleteI have the following scenario.
1) I call a method in the App module.
2) The method fires a query on a VO say searchVo
3) I iterate through the result set and populate a transient Vo "SearchResultVO"
4) Use this transient VO to display the result as a table.
My problem is I am unable to sort the columns. The table goes blank "No data to display".
Thanks for any help
Hi Jobinesh,
ReplyDeletewhen AM pooling is disabled (setting jvm startup parameter -Djbo.ampool.doampooling=false), the sorting stops working. I tried setting passivate state (including all transient values) to true in TransientViewObj, but still no luck. Do you know how to get around this issue?
Hello Jobinesh, a need I have a ViewObject that has many based atrributtes and one transient atrributte, but I just need to Sort that Vo having that transient atrributte.
ReplyDeleteIt could be possible????
Sorry for my english!!
This comment has been removed by the author.
ReplyDeleteRaúl,
ReplyDeleteCan you please see if the following post helps: http://www.jobinesh.com/2013/05/explicitly-enabling-in-memory-sorting.html