ACQ scroll back to top of lineitem info page
authorBill Erickson <berick@esilibrary.com>
Mon, 17 Sep 2012 18:50:36 +0000 (14:50 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 17 Oct 2012 01:33:44 +0000 (21:33 -0400)
When displaying the lineitem "info" page (li attributes, marc record),
be sure to scroll to the top of the page instead of relying on the
previous scroll location.  In particular, if you last viewed a LI
toward the bottom of the page, returned (causes scroll down), then go
back into the info page, the page will be scrolled to the bottom.

The solution is a little funkier than I'd hoped.  The scroll-to point
has to be a node that is a) within the scrolling dojo div and b). non-
visible when scrollIntoView is called.  Since the top-level
page div may be different, depending on who is loading li_table, we rely
on the caller to place an id=oils-scroll-to-top div in the page for
general top-scrolling.  (Note, also, window.scrollTo does not work when
it's the div and not the full page that needs scrolling).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/acq/picklist/view.tt2
Open-ILS/src/templates/acq/po/view.tt2
Open-ILS/src/templates/acq/search/unified.tt2
Open-ILS/web/js/ui/default/acq/common/li_table.js

index 65af63b..5d4d2c2 100644 (file)
@@ -2,6 +2,7 @@
 [% ctx.page_title = 'Selection List' %]
 <div dojoType="dijit.layout.ContentPane" style="height:100%">
     <div class='container'>
+        <div id='oils-scroll-to-top'></div>
         <div id='oils-acq-picklist-header'>
             Selection list <span id='oils-acq-picklist-name'> </span>
             <div class='oils-acq-picklist-attributes'>
index afa2edc..1baf68a 100644 (file)
@@ -1,6 +1,7 @@
 [% WRAPPER 'base.tt2' %]
 [% ctx.page_title = "Purchase Order" %]
 <div dojoType="dijit.layout.ContentPane" style="height:100%">
+    <div id='oils-scroll-to-top'></div>
     <div>
         <div id='oils-acq-picklist-header'>
             <big>
index 41b3a60..0a7259d 100644 (file)
@@ -6,6 +6,7 @@
 <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/acq/search/picklist.js"></script>
 <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/acq/search/purchase_order.js"></script>
 <div id="acq-unified-body" class="hidden">
+    <div id='oils-scroll-to-top'></div>
     <div id="acq-unified-heading">
         <span id="acq-unified-heading-actual">Acquisitions Search</span>
         <span id="acq-unified-heading-controls">
index 0ed491e..5f5df76 100644 (file)
@@ -1089,6 +1089,9 @@ function AcqLiTable() {
                 oilsBasePath + "/acq/lineitem/related/" + li.id();
         }
 
+        // if a top scroll point is defined, jump up to it here
+        var node = dojo.byId('oils-scroll-to-top');
+        if (node) dijit.scrollIntoView(node);
     };
 
     this.generateMakeRecTab = function(bib_id,default_view, row) {