changeset 33:de56f3951fad

fix sort
author jodogne
date Thu, 30 Aug 2012 12:36:26 +0200
parents 0c3e317f35e8
children dfb159a079ea
files PalantirExplorer/explorer.js
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/PalantirExplorer/explorer.js	Thu Aug 30 09:35:38 2012 +0200
+++ b/PalantirExplorer/explorer.js	Thu Aug 30 12:36:26 2012 +0200
@@ -88,11 +88,23 @@
 
 function SortOnDicomTag(arr, tag, isInteger, reverse)
 {
+  var defaultValue;
+  if (isInteger)
+    defaultValue = 0;
+  else
+    defaultValue = '';
+
   arr.sort(function(a, b) {
     var ta = a.MainDicomTags[tag];
     var tb = b.MainDicomTags[tag];
     var order;
 
+    if (ta == undefined)
+      ta = defaultValue;
+
+    if (tb == undefined)
+      tb = defaultValue;
+
     if (isInteger)
     {
       ta = parseInt(ta, 10);