Reputation: 373
The XPages JDBC application uses the derby1 connection and the examples show being able to sort the columns in ascending/descending order. The design elements show the column headings with sortable="true" which is what I have in my app, but my columns won't sort. You can see a table structure using the Table Meta Data listing, but that doesn't say if the data element is indexed. Our DBA says that the index doesn't allow/disallow sorting and that I have to use the order by.
So, how is sorting being accomplished in this application when there is no event tied to the columnheader?
Upvotes: 1
Views: 171
Reputation: 978
Your dba is right, you can order by a unindexed column (use ORDER BY YourColumnName
in your SQL statement). Both datasources (JdbcRowSet and JdbcQuery) allow you to specify sqlQuery
parameter, which can contain this clause. Unfortunately you cannot use sqlParameters
properties for sorting (this is probably because java.sql.PreparedStatement
does not allow you specify an ORDER BY parameter).
On SSJS side, you can use @JdbcDbColumn()
function, which allows orderBy as fifth parameter, or use your own SQL statement with @JdbcExecuteQuery
.
Upvotes: 3