Paging
The CAF.Table.Model has several methods for accessing the table's paging state. The getFirst() method returns the zero-based index of the first row on the current page. The getRows() method returns the current page size but the size might not equal the actual number or rows.
The size() method, inherited from the CAF.Select.Model returns the actual number of rows. The getRowCount() method returns the total number of rows in the table, or if the total is unknown, returns -1. The getRowSelectedCount() method returns the total number of selected rows in the table.
All of the CAF.Table.Model row manipulation methods inherited from CAF.Select.Model, such as add(), remove(), and setSelected() operate only on the current page. For example, calling table.setSelected(0) sets the first item of the table on the current page selected rather than the first item in the entire table. Two special methods, go(first, rows, sort) and move(from, to) operate across page boundaries, and use row indices relative to the entire table.
The go(first, rows, sort) method pages or re-sorts the entire table; it re-sorts the table by the columns, and in the order, specified by the sort string. It allows three arguments:
The first argument (first) is greater or equal to zero, it pages the table to the index specified by the argument
The second argument (rows) is greater than zero, it sets the new page size to the size specified by the argument
The third argument is non-null and non-empty
The sort string is a comma-separated view (CSV) list of column IDs to sort, in order from the primary sort, to the secondary sort, and continuing using the specified sort order. Follow each column ID with a plus (+) or minus (-) to indicate ascending order or descending order. For example, the sort stringuser+,permissions+,modified- specifies sorting the table by the user column in ascending order, then by the permissions column in ascending order, and by the modified column in descending order.
The move(from, to) method moves a row from the table index specified by the first argument (from) to the table index specified by the second argument (to). It does not page the table, even if one or both of the indices are outside of the current page. Note that the table content-provider must implement the IReorderableTableContentProvider interface, and return true for the interface's isReorderable() method to persist the row arrangement.
For more information about CAF controls, see the
webMethods CAF Tag Library Reference, as described in
Finding Information about CAF
Controls.
Related Topics