diff --git a/Release Notes.md b/Release Notes.md index 901182b..1d3e3fb 100644 --- a/Release Notes.md +++ b/Release Notes.md @@ -1,5 +1,6 @@ # Release Notes +* v0.8.5: Pagination Helper updated to 1.3 * v0.8.4: Pagination Helper updated to 1.2 * v0.8.3: Calendar Helper updated to 1.1, Media Helpers updated to 1.3 * v0.8.2: Media Helpers updated to 1.2 @@ -21,6 +22,7 @@ ## Pagination Helper +* v1.3: Support sorting with pagination by way of the `sortBy` parameter * v1.2: Use `pageLinksBeside` to specify number of links to show before & after current in the Pager * v1.1: `perPage` parameter can now be overridden diff --git a/dist/xslt/_CalendarHelper.xslt b/dist/xslt/_CalendarHelper.xslt index de15591..00010a2 100644 --- a/dist/xslt/_CalendarHelper.xslt +++ b/dist/xslt/_CalendarHelper.xslt @@ -3,7 +3,7 @@ ]> - + diff --git a/dist/xslt/_GroupingHelper.xslt b/dist/xslt/_GroupingHelper.xslt index 253ee84..f81b79f 100644 --- a/dist/xslt/_GroupingHelper.xslt +++ b/dist/xslt/_GroupingHelper.xslt @@ -1,5 +1,5 @@ - + diff --git a/dist/xslt/_MediaHelper.xslt b/dist/xslt/_MediaHelper.xslt index b09c394..00cf395 100644 --- a/dist/xslt/_MediaHelper.xslt +++ b/dist/xslt/_MediaHelper.xslt @@ -8,7 +8,7 @@ Enables simple retrieval of media by handling the GetMedia() call and error-checking --> - + diff --git a/dist/xslt/_NavigationHelper.xslt b/dist/xslt/_NavigationHelper.xslt index 82b6799..bf88227 100644 --- a/dist/xslt/_NavigationHelper.xslt +++ b/dist/xslt/_NavigationHelper.xslt @@ -3,7 +3,7 @@ ]> - + diff --git a/dist/xslt/_PaginationHelper.xslt b/dist/xslt/_PaginationHelper.xslt index 2cbdfd7..52d1617 100644 --- a/dist/xslt/_PaginationHelper.xslt +++ b/dist/xslt/_PaginationHelper.xslt @@ -1,5 +1,5 @@ - + @@ -52,7 +52,10 @@ - + + + + @@ -65,8 +68,25 @@ - - + + + + + + + + + + + + + + + + + + + @@ -242,5 +262,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/paginationhelper/README.md b/paginationhelper/README.md index 77da22a..8b11682 100644 --- a/paginationhelper/README.md +++ b/paginationhelper/README.md @@ -55,6 +55,29 @@ output, you can turn them off with the `showPager` parameter by supplying `false can manually output the controls by calling `RenderPager`, using the same `selection` parameter as you called the `PaginateSelection` template with, to get the paging controls where you want them. +## Sorting the output + +Sometimes, the data you want to paginate is actually also being sorted when rendered, e.g. like this common scenario: + +```xslt + + + +``` + +The problem with introducing pagination here, is that most often you get the pagination happening *before* sorting, but you really want to *sort* the results first and then perform the pagination. For that you use the `sortBy` parameter: + +```xslt + + + + +``` + +*Note that it's a string combining the name of the element or attribute to sort by and the direction (`ASC` or `DESC`), separated by a space. `ASC` is the default so you don't even need to specify the direction, unless it's `DESC`.* + +It won't cover every scenario, e.g. it doesn't do numerical sorting yet, and you can only sort by a single element/attribute, where the element has to be a direct child of the node being sorted. Still, this should cover **a lot** of use cases. + ## QueryString options The pager links rendered will include all existing querystring options on the original page (i.e., "page 1"), so if diff --git a/paginationhelper/_PaginationHelper.xslt b/paginationhelper/_PaginationHelper.xslt index ea60d71..f5b9cb1 100644 --- a/paginationhelper/_PaginationHelper.xslt +++ b/paginationhelper/_PaginationHelper.xslt @@ -72,7 +72,10 @@ - + + + + @@ -85,8 +88,25 @@ - - + + + + + + + + + + + + + + + + + + + @@ -262,5 +282,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/paginationhelper/test/PaginationHelperSortedSample.xslt b/paginationhelper/test/PaginationHelperSortedSample.xslt new file mode 100644 index 0000000..68c7567 --- /dev/null +++ b/paginationhelper/test/PaginationHelperSortedSample.xslt @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + +

+ +

+
+ + + +
\ No newline at end of file diff --git a/paginationhelper/test/PaginationHelperSortedTest.xspec b/paginationhelper/test/PaginationHelperSortedTest.xspec new file mode 100644 index 0000000..df35d2e --- /dev/null +++ b/paginationhelper/test/PaginationHelperSortedTest.xspec @@ -0,0 +1,168 @@ + + + + + + + + + + + + +

James Sawyer

+

Kate Austen

+

Penelope Widmore

+

Hugo Reyes

+

Jack Shepard

+
+
+ + + + + + +

Hugo Reyes

+

Jack Shepard

+

James Sawyer

+

Kate Austen

+

Penelope Widmore

+
+ + + + + + +

Hugo Reyes

+

Jack Shepard

+

James Sawyer

+

Kate Austen

+

Penelope Widmore

+
+
+ + + + + + +

Hugo Reyes

+

Jack Shepard

+

James Sawyer

+

Kate Austen

+

Penelope Widmore

+
+
+ + + + + + +

Penelope Widmore

+

Kate Austen

+

James Sawyer

+

Jack Shepard

+

Hugo Reyes

+
+
+ + + + + + +

Penelope Widmore

+

Kate Austen

+

James Sawyer

+

Jack Shepard

+

Hugo Reyes

+
+
+ + + + + + + +

Hugo Reyes

+

Jack Shepard

+

James Sawyer

+
+ + + + + + +

Kate Austen

+

Penelope Widmore

+
+
+
+ +
+ + + + + + + +

Jack Shepard

+

Kate Austen

+

Hugo Reyes

+

Penelope Widmore

+

James Sawyer

+
+ + + + + + +

Jack Shepard

+

Kate Austen

+

Hugo Reyes

+

Penelope Widmore

+

James Sawyer

+
+
+ + + + + + +

James Sawyer

+

Penelope Widmore

+

Hugo Reyes

+

Kate Austen

+

Jack Shepard

+
+
+ + + + + + + +

...

+

...

+

...

+
+
+ +
+ +
+ +
\ No newline at end of file diff --git a/paginationhelper/test/PreSortingTest.xspec b/paginationhelper/test/PreSortingTest.xspec new file mode 100644 index 0000000..55742b1 --- /dev/null +++ b/paginationhelper/test/PreSortingTest.xspec @@ -0,0 +1,23 @@ + + + + + + + + + + 4 + 5 + 1 + 2 + 3 + + + + + \ No newline at end of file diff --git a/paginationhelper/test/fixtures/people-with-nicks.xml b/paginationhelper/test/fixtures/people-with-nicks.xml new file mode 100644 index 0000000..b9bd7fb --- /dev/null +++ b/paginationhelper/test/fixtures/people-with-nicks.xml @@ -0,0 +1,23 @@ + + + + James Sawyer + james.sawyer@4815162342x.com + + + Kate Austen + kate.austen@4815162342x.com + + + Penelope Widmore + penelope.widmore@4815162342x.com + + + Hugo Reyes + hugo.reyes@4815162342x.com + + + Jack Shepard + jack.shepard@4815162342x.com + + \ No newline at end of file diff --git a/version.ent b/version.ent index 7f12095..44c2c4b 100644 --- a/version.ent +++ b/version.ent @@ -1,8 +1,8 @@ - + - +