From d2c3ba2e220eb333a7e4dd694f429544a348a06b Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 2 Sep 2008 13:58:45 +0000 Subject: [PATCH] using addOnLoad (thanks, dbs). using atomic version of queued record fetcher to bypass streaming response bug (still not sure what's up with that) git-svn-id: svn://svn.open-ils.org/ILS/trunk@10503 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/vandelay/vandelay.html | 2 +- Open-ILS/web/vandelay/vandelay.js | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/vandelay/vandelay.html b/Open-ILS/web/vandelay/vandelay.html index 85c6edd336..ed982e8fd0 100644 --- a/Open-ILS/web/vandelay/vandelay.html +++ b/Open-ILS/web/vandelay/vandelay.html @@ -25,7 +25,7 @@ - +
diff --git a/Open-ILS/web/vandelay/vandelay.js b/Open-ILS/web/vandelay/vandelay.js index 1477b8fbc4..48acd606c3 100644 --- a/Open-ILS/web/vandelay/vandelay.js +++ b/Open-ILS/web/vandelay/vandelay.js @@ -166,9 +166,10 @@ function processSpool(key, queue, type, onload) { function retrieveQueuedRecords(type, queueId, onload) { fieldmapper.standardRequest( - ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.records.retrieve'], + ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.records.retrieve.atomic'], { async: true, params: [authtoken, queueId, {clear_marc:1}], + /* intermittent bug in streaming, multipart requests prevents use of onreponse for now... onresponse: function(r) { var rec = r.recv().content(); if(e = openils.Event.parse(rec)) @@ -176,7 +177,18 @@ function retrieveQueuedRecords(type, queueId, onload) { queuedRecords.push(rec); queuedRecordsMap[rec.id()] = rec; }, - oncomplete: function(){onload();} + */ + oncomplete: function(r){ + var recs = r.recv().content(); + if(e = openils.Event.parse(recs)) + return alert(e); + for(var i = 0; i < recs.length; i++) { + var rec = recs[i]; + queuedRecords.push(rec); + queuedRecordsMap[rec.id()] = rec; + } + onload(); + } } ); } @@ -201,9 +213,9 @@ function buildRecordGrid(type) { /* test structure... */ var structure = [{ - noscroll : true, + //noscroll : true, cells : [[ - {name: 'ID', field: 'id'}, + //{name: 'ID', field: 'id'}, ]] }]; @@ -211,11 +223,13 @@ function buildRecordGrid(type) { for(var i = 0; i < defs.length; i++) { var attr = defs[i] attrMap[attr.code()] = attr.id(); - structure[0].cells[0].push({ + var col = { name:attr.description(), field:'attr.' + attr.code(), get: getAttrValue - }); + }; + if(attr.code().match(/title/i)) col.width = 'auto'; // this is hack. + structure[0].cells[0].push(col); } vlQueueGrid.setStructure(structure); @@ -263,3 +277,5 @@ function batchUpload() { createQueue(queueName, currentType, handleCreateQueue); } + +dojo.addOnLoad(vlInit); -- 2.43.2