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.

Comments

  1. Thanks for the example, it is a helpful information when you work with programatic VO.

    ReplyDelete
  2. Hi Jobesh, thanks for sharing such a very useful information

    ReplyDelete
  3. I tried implementing same way, but instead of hard coding rows, I have populated rows programatically by calling some other service,
    I 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?

    ReplyDelete
  4. Thanks for reply,
    I tried estimatedRowCount() , but still getting zero.
    Thanks

    ReplyDelete
  5. Hi,
    I 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

    ReplyDelete
  6. Hi Jobinesh,

    when 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?

    ReplyDelete
  7. 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.
    It could be possible????
    Sorry for my english!!

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Raúl,
    Can you please see if the following post helps: http://www.jobinesh.com/2013/05/explicitly-enabling-in-memory-sorting.html

    ReplyDelete

Post a Comment