Introduced a check for empty value in record processing
authorSebastian Hammer <quinn@indexdata.com>
Fri, 13 Apr 2007 17:19:53 +0000 (17:19 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Fri, 13 Apr 2007 17:19:53 +0000 (17:19 +0000)
js/pz2.js
www/masterkey/js/client.js

index ff5ca24..2cacae9 100644 (file)
--- a/js/pz2.js
+++ b/js/pz2.js
@@ -1,5 +1,5 @@
 /*
-** $Id: pz2.js,v 1.5 2007-04-03 14:27:21 jakub Exp $
+** $Id: pz2.js,v 1.6 2007-04-13 17:19:53 quinn Exp $
 ** pz2.js - pazpar2's javascript client library.
 */
 
@@ -308,7 +308,11 @@ pz2.prototype = {
                         for ( j = 0; j < locationNodes[i].childNodes.length; j++) {
                             if ( locationNodes[i].childNodes[j].nodeType == Node.ELEMENT_NODE ) {
                                 var nodeName = locationNodes[i].childNodes[j].nodeName;
-                                var nodeText = locationNodes[i].childNodes[j].firstChild.nodeValue;
+                                var nodeText;
+                               if (locationNodes[i].childNodes[j].firstChild)
+                                       nodeText = locationNodes[i].childNodes[j].firstChild.nodeValue;
+                               else
+                                       nodeText = '';
                                 record["location"][i][nodeName] = nodeText;                            
                             }
                         }
index 8b46f49..9838160 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** $Id: client.js,v 1.12 2007-04-13 01:10:21 quinn Exp $
+** $Id: client.js,v 1.13 2007-04-13 17:19:53 quinn Exp $
 ** MasterKey - pazpar2's javascript client .
 */
 
@@ -90,6 +90,7 @@ function my_onshow(data)
                             currentDetailedId = null;
                             return;
                         } else if (currentDetailedId != null) {
+                            $(this.parentNode.lastChild).remove();
                             $('#rec_'+currentDetailedId).children('.detail').remove();
                         }
                         currentDetailedId = clickedId;