Permalink
Browse files

FEATURE: Input box for going to a page in gridfield

  • Loading branch information...
1 parent 38db2c1 commit 4ad7e8ef8d285e4f143bf54ad9ea0b7ccedacf81 @andrewandante andrewandante committed Mar 8, 2012
Showing with 15 additions and 1 deletion.
  1. +14 −0 javascript/GridField.js
  2. +1 −1 templates/Includes/GridFieldPaginator_Row.ss
View
@@ -247,4 +247,18 @@
}
});
+ $(".ss-gridfield .pagination-page-number input").entwine({
+ onkeydown: function(event) {
+ if(event.keyCode == 13) {
+ var newpage = parseInt($(this).val(), 10);
+
+ var gridfield = $(this).getGridField();
+ gridfield.setState('GridFieldPaginator', {currentPage: newpage});
+ gridfield.reload();
+
+ return false;
+ }
+ }
+ });
+
}(jQuery));
@@ -1,7 +1,7 @@
<tr>
<td class="bottom-all" colspan="$Colspan">
<div class="datagrid-pagination">
- $FirstPage $PreviousPage <span class="pagination-page-number">Page $CurrentPageNum of $NumPages</span> $NextPage $LastPage
+ $FirstPage $PreviousPage <span class="pagination-page-number">Page <input value="$CurrentPageNum"/> of $NumPages</span> $NextPage $LastPage
</div>
<span class="pagination-records-number">View $FirstShownRecord - $LastShownRecord of $NumRecords</span>

0 comments on commit 4ad7e8e

Please sign in to comment.