From e3d7b4ea259cd46a592a55280acba640c2c1da01 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 29 Apr 2010 15:14:20 +0000 Subject: [PATCH] added paging to user picklist retrieval/display git-svn-id: svn://svn.open-ils.org/ILS/trunk@16344 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Acq/Picklist.pm | 11 +++++++-- .../web/js/ui/default/acq/picklist/view_list.js | 26 +++++++++++++++++----- .../web/templates/default/acq/picklist/list.tt2 | 1 + 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm index d9b6c8303..fb7e72e62 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm @@ -193,11 +193,18 @@ sub retrieve_user_picklist { my($self, $conn, $auth, $options) = @_; my $e = new_editor(authtoken=>$auth); return $e->die_event unless $e->checkauth; + $options ||= {}; # don't grab the PL with name == "", because that is the designated temporary picklist my $list = $e->search_acq_picklist([ - {owner=>$e->requestor->id, name=>{'!='=>''}}, - {order_by => {acqpl => 'name'}} + { + owner=>$e->requestor->id, + name=>{'!='=>''} + }, { + order_by => {acqpl => 'name'}, + limit => $$options{limit} || 10, + offset => $$options{offset} || 0, + } ], {idlist=>1} ); diff --git a/Open-ILS/web/js/ui/default/acq/picklist/view_list.js b/Open-ILS/web/js/ui/default/acq/picklist/view_list.js index 740f2334d..cff62aeff 100644 --- a/Open-ILS/web/js/ui/default/acq/picklist/view_list.js +++ b/Open-ILS/web/js/ui/default/acq/picklist/view_list.js @@ -15,8 +15,12 @@ var listAll = false; var plCache = {}; function loadGrid() { - dojo.connect(plMergeDialog, 'onOpen', function(){loadLeadPlSelector();}); + plListGrid.dataLoader = gridDataLoader; + gridDataLoader(); +} + +function gridDataLoader() { var method = 'open-ils.acq.picklist.user.retrieve'; if(listAll) @@ -25,13 +29,25 @@ function loadGrid() { fieldmapper.standardRequest( ['open-ils.acq', method], { async: true, - params: [openils.User.authtoken, {flesh_lineitem_count:1, flesh_owner:1}], + params: [ + openils.User.authtoken, + { + flesh_lineitem_count:1, + flesh_owner:1, + offset : plListGrid.displayOffset, + limit : plListGrid.displayLimit, + } + ], onresponse : function(r) { var pl = openils.Util.readResponse(r); - if(!pl) return; - plCache[pl.id()] = pl; - plListGrid.store.newItem(acqpl.toStoreItem(pl)); + if(pl) { + plCache[pl.id()] = pl; + plListGrid.store.newItem(acqpl.toStoreItem(pl)); + } }, + oncomplete : function() { + plListGrid.hideLoadProgressIndicator(); + } } ); } diff --git a/Open-ILS/web/templates/default/acq/picklist/list.tt2 b/Open-ILS/web/templates/default/acq/picklist/list.tt2 index 026392c55..15c237267 100644 --- a/Open-ILS/web/templates/default/acq/picklist/list.tt2 +++ b/Open-ILS/web/templates/default/acq/picklist/list.tt2 @@ -88,6 +88,7 @@ query="{id: '*'}" defaultCellWidth='"auto"' fmClass='acqpl' + showPaginator='true' editOnEnter='true'> -- 2.11.0