Forum Stats

  • 3,826,361 Users
  • 2,260,636 Discussions
  • 7,896,916 Comments

Discussions

Sorting in adf table before commit.

User_UFM1Q
User_UFM1Q Member Posts: 2 Green Ribbon

Java(TM) Platform 1.8.0_211

Build JDEVADF_12.2.1.4.0_GENERIC_200613.1114.S


Hello. I have next problem:

I have adf table and when i add rows and don't commit changes, this rows don't sorting.


Please, help.

Tagged:

Answers

  • dvohra21
    dvohra21 Member Posts: 14,573 Gold Crown

    Sorting has to be performed by user.

    In the The Create Table dialog

    Allow the ADF Model layer to handle column sorting by selecting the Enabling Sorting checkbox. Selecting this option means that the iterator binding will access the iterator, which will perform an order-by query to determine the order. Select this option unless you do not want to allow column sorting.


    Set column attributes:

    Column Attributes


       

    sortProperty


    Determines the property on which to sort the column.


    Set to the columns corresponding attribute binding value.


    sortable


    Determines whether a column can be sorted.


    Set to false. When set to true, the iterator binding will access the iterator to determine the order.


    32.4.4 What You May Need to Know About Creating a Row and Sorting Columns

    If your table columns allow sorting, and the user has sorted on a column before inserting a new row, then that new row will not be sorted. To have the column sort with the new row, the user must first sort the column opposite to the desired sort, and then resort. This is because the table assumes the column is already sorted, so clicking on the desired sort order first will have no effect on the column.


    For example, say a user had sorted a column in ascending order, and then added a new row. Initially, that row appears at the top. If the user first clicks to sort the column again in ascending order, the table will not resort, as it assumes the column is already in ascending order. The user must first sort on descending order and then ascending order.


    If you want the data to automatically sort on a specific column in a specific order after inserting a row, then programmatically queue a SortEvent after the commit, and implement a handler to execute the sort.


    If you want to allow sorting on a column for which the view object attribute is defined by a custom domain data type, you must implement the compareTo() method for the table's sort button click event:


    public int compareTo(Object theObject)

    The method will return 0 for values that are equal, less then 0 if the current object is less than theObject, and greater than 0 if the current object is greater. The object comparison for attributes behaves just like String comparisons.

    https://docs.oracle.com/middleware/12213/adf/develop/creating-adf-databound-tables1.htm#ADFFD756

  • User_UFM1Q
    User_UFM1Q Member Posts: 2 Green Ribbon

    All columns have sortable = true, and sortProperty. But sorting work only afer commit. In this documentation wrote that sorting must work before commit.

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,457 Red Diamond

    It the vo you are using a normal one based on an entity?

    If the new data submitted to the model layer?

    Timo

  • dvohra21
    dvohra21 Member Posts: 14,573 Gold Crown

    If you want the data to automatically sort on a specific column in a specific order before inserting a row, then programmatically queue a SortEvent before the commit, and implement a handler to execute the sort. For more information about adding functionality to a declarative operation (such as the Commit operation), see Section 28.4, "Overriding Declarative Methods."