diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-06-16 11:00:01 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-06-17 16:01:40 -0400 |
commit | 79ce958a3c9e182a4b4ee0850d7315fdd51982d7 (patch) | |
tree | 57936b4f0eef1ef78ebf72a177bde72be9a4c878 /install/ui/widget.js | |
parent | a2a3782efb386f18689faf35a069c4da1085e87d (diff) | |
download | freeipa-79ce958a3c9e182a4b4ee0850d7315fdd51982d7.tar.gz freeipa-79ce958a3c9e182a4b4ee0850d7315fdd51982d7.tar.xz freeipa-79ce958a3c9e182a4b4ee0850d7315fdd51982d7.zip |
Storing page number in URL.
The association facet has been modified to store the current page
number in the browser's URL. This way page changes are stored in
browser's history allowing the back button to work properly.
Ticket #1264
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r-- | install/ui/widget.js | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js index 80906a2f5..b486145bd 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -1334,10 +1334,7 @@ IPA.table_widget = function (spec) { text: 'Prev', name: 'prev_page', click: function() { - if (that.current_page > 1) { - that.current_page--; - that.refresh(); - } + that.prev_page(); return false; } }).appendTo(that.pagination); @@ -1348,10 +1345,7 @@ IPA.table_widget = function (spec) { text: 'Next', name: 'next_page', click: function() { - if (that.current_page < that.total_pages) { - that.current_page++; - that.refresh(); - } + that.next_page(); return false; } }).appendTo(that.pagination); @@ -1363,15 +1357,8 @@ IPA.table_widget = function (spec) { name: 'current_page', keypress: function(e) { if (e.which == 13) { - var page = parseInt($(this).val(), 10); - if (page < 1) { - page = 1; - } else if (page > that.total_pages) { - page = that.total_pages; - } - that.current_page = page; - $(this).val(page); - that.refresh(); + var page = parseInt(that.current_page_input.val(), 10) || 1; + that.set_page(page); } } }).appendTo(that.pagination); @@ -1384,7 +1371,32 @@ IPA.table_widget = function (spec) { } }; - that.select_changed = function(){ + that.prev_page = function() { + if (that.current_page > 1) { + that.current_page--; + that.refresh(); + } + }; + + that.next_page = function() { + if (that.current_page < that.total_pages) { + that.current_page++; + that.refresh(); + } + }; + + that.set_page = function(page) { + if (page < 1) { + page = 1; + } else if (page > that.total_pages) { + page = that.total_pages; + } + that.current_page = page; + that.current_page_input.val(page); + that.refresh(); + }; + + that.select_changed = function() { }; that.setup = function(container) { @@ -1521,6 +1533,9 @@ IPA.table_widget = function (spec) { that.table_create = that.create; that.table_setup = that.setup; that.table_set_enabled = that.set_enabled; + that.table_prev_page = that.prev_page; + that.table_next_page = that.next_page; + that.table_set_page = that.set_page; return that; }; |