added paging to queued recs grid
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 17 Sep 2008 20:40:15 +0000 (20:40 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 17 Sep 2008 20:40:15 +0000 (20:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10626 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/vandelay/vandelay.html
Open-ILS/web/vandelay/vandelay.js

index 0ea9811..a2c7dcd 100644 (file)
@@ -47,7 +47,7 @@
                 border: 1px solid red; 
             }
         </style>
-        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
+        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
         <script type="text/javascript" src='/js/dojo/openils/MarcXPathParser.js'></script>
         <script type="text/javascript" src='vandelay.js'></script>
     </head>
                 }
             </script>
             <div id='vl-queue-div-grid' class='tall'>
-                <button dojoType='dijit.form.Button' onclick='vlSelectAllGridRecords();'>Select All</button>
-                <button dojoType='dijit.form.Button' onclick='vlSelectNoGridRecords();'>Select None</button>
-                <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>Import Selected</button>
-                Only show records with possible matches <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches' 
-                    checked='checked' onclick='retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords)'/>
+                <table width='100%'>
+                    <tr><td align='left'>
+                            <button dojoType='dijit.form.Button' onclick='vlSelectAllGridRecords();'>Select All</button>
+                            <button dojoType='dijit.form.Button' onclick='vlSelectNoGridRecords();'>Select None</button>
+                            <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>Import Selected</button>
+                        </td>
+                        <td align='right'>
+                            <span style='padding-right:4px;'>
+                                <a href='javascript:void(0);' onclick='
+                                    var page = parseInt(vlQueueDisplayPage.getValue());
+                                    if(page < 2) return;
+                                    vlQueueDisplayPage.setValue(page - 1);
+                                    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);'>&#171; Previous Page</a>
+                            </span>
+                            <span style='padding-right:4px;'>
+                                <a href='javascript:void(0);' onclick='
+                                    vlQueueDisplayPage.setValue(parseInt(vlQueueDisplayPage.getValue())+1);
+                                    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);'>Next Page &#187;</a>
+                            </span>
+                            Only show possible matches
+                            <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches' checked='checked'/>
+                            Page Size <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayLimit' value='10'/>
+                            Page <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
+                                <button dojoType='dijit.form.Button' 
+                                onclick='retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords)'>Refresh</button>
+                    </td></tr>
+                </table>
                 <div class='tall'>
                     <div dojoType='dojox.Grid' jsId='vlQueueGrid' class='tall'> </div>
                 </div>
index 6f18cc4..ff52073 100644 (file)
@@ -238,10 +238,18 @@ function retrieveQueuedRecords(type, queueId, onload) {
     if(vlQueueGridShowMatches.checked)
         method = method.replace('records', 'records.matches');
 
+    var limit = parseInt(vlQueueDisplayLimit.getValue());
+    var offset = limit * parseInt(vlQueueDisplayPage.getValue()-1);
+
     fieldmapper.standardRequest(
         ['open-ils.vandelay', method],
         {   async: true,
-            params: [authtoken, queueId, {clear_marc:1}],
+            params: [authtoken, queueId, 
+                {   clear_marc: 1, 
+                    offset: offset,
+                    limit: limit
+                }
+            ],
             /* intermittent bug in streaming, multipart requests prevents use of onreponse for now...
             onresponse: function(r) {
                 var rec = r.recv().content();
@@ -457,7 +465,7 @@ function buildRecordGrid(type) {
 
     currentOverlayRecordsMap = {};
 
-    if(queuedRecords.length == 0) {
+    if(queuedRecords.length == 0 && vlQueueDisplayPage.getValue() == 1) {
         dojo.style(dojo.byId('vl-queue-no-records'), 'display', 'block');
         dojo.style(dojo.byId('vl-queue-div-grid'), 'display', 'none');
         return;