|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.web.controller.helper.DataTablesPagingHelper
public class DataTablesPagingHelper
Nested Class Summary | |
---|---|
static class |
DataTablesPagingHelper.DataTablesInputs
Input command processor for supporting DataTables server-side processing. |
Constructor Summary | |
---|---|
DataTablesPagingHelper()
|
Method Summary | |
---|---|
protected void |
applyTableJsonSort(List<Object> modelCollection,
List<ColumnSort> oldColumnSorts,
List<ColumnSort> newColumnSorts,
CollectionGroup collectionGroup,
View view)
Sort the given modelCollection (in place) according to the specified columnSorts. |
Integer |
getFilteredCollectionSize()
|
TableLayoutManager |
getTableLayoutManager()
|
int |
getTotalCollectionSize()
|
void |
processPagingRequest(View view,
String tableId,
UifFormBase form,
DataTablesPagingHelper.DataTablesInputs dataTablesInputs)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataTablesPagingHelper()
Method Detail |
---|
public void processPagingRequest(View view, String tableId, UifFormBase form, DataTablesPagingHelper.DataTablesInputs dataTablesInputs)
protected void applyTableJsonSort(List<Object> modelCollection, List<ColumnSort> oldColumnSorts, List<ColumnSort> newColumnSorts, CollectionGroup collectionGroup, View view)
Not all columns will necessarily be directly mapped to the modelCollection, so the collectionGroup and view are available as well for use in calculating those other column values. However, if all the columns are in fact mapped to the elements of the modelCollection, subclasses should be able to easily override this method to provide custom sorting logic.
Create an index array and sort that. The array slots represents the slots in the modelCollection, and the values are indices to the elements in the modelCollection. At the end, we'll re-order the modelCollection so that the elements are in the collection slots that correspond to the array locations. A small example may be in order. Here's the incoming modelCollection: modelCollection = { "Washington, George", "Adams, John", "Jefferson, Thomas", "Madison, James" } Initialize the array with its element references all matching initial positions in the modelCollection: reSortIndices = { 0, 1, 2, 3 } After doing our sort in the array (where we sort indices based on the values in the modelCollection): reSortIndices = { 1, 2, 3, 0 } Then, we go back and apply that ordering to the modelCollection: modelCollection = { "Adams, John", "Jefferson, Thomas", "Madison, James", "Washington, George" } Why do it this way instead of just sorting the modelCollection directly? Because we may need to know the original index of the element e.g. for the auto sequence column.
modelCollection
- the collection to sortoldColumnSorts
- the sorting that reflects the current state of the collectionnewColumnSorts
- the sorting to apply to the collectioncollectionGroup
- the CollectionGroup that is being renderedview
- the viewpublic int getTotalCollectionSize()
public Integer getFilteredCollectionSize()
public TableLayoutManager getTableLayoutManager()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |