This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

--Standard Sorting on the Server Side

Documents for the development of and with JVx.

--Standard Sorting on the Server Side

Postby Development@SIB » Thu Sep 16, 2010 12:12 pm



This article is outdated - please use our new system at

https://doc.sibvisions.com




User-friendly UIs prepare and display data in clearly arranged form. This includes clear and relevant sorting of data.

There are several different ways to sort data and sorting can happen at various tiers. The client (client tier) can handle sorting, although that would mean that unwanted logic is located at the client. The database (data tier) also offers ways to sort data, for example, through the use of views. Unfortunately not all databases supporting sorting using views. That only leaves the application server and therefore the business logic (enterprise tier) for sorting.

The following instruction sorts the data. Please note that this is standard sorting. If the client requests a different sorting method, it will be preferred.

Code: Select all
public DBStorage getUserDefaults() throws Exception
{
    DBStorage userDefaults = (DBStorage)get("userDefaults");
   
    if (userDefaults == null)
    {
        userDefaults = new DBStorage();
        userDefaults.setDBAccess(getDBAccess());
        userDefaults.setWritebackTable("USERS");
        userDefaults.setDefaultSort(new SortDefinition(false, "USERNAME"));
        userDefaults.open();
         
        put("userDefaults", userDefaults);
    }

    return userDefaults;
}
User avatar
Development@SIB
 
Posts: 325
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation