Fixed bug in staff client offline mode.
authorDmitry Nechai <nechai.dmitry@gmail.com>
Tue, 16 Apr 2013 21:33:57 +0000 (00:33 +0300)
committerJason Stephenson <jstephenson@mvlc.org>
Thu, 18 Apr 2013 15:16:38 +0000 (11:16 -0400)
https://bugs.launchpad.net/evergreen/+bug/1089657

In list.js at start you create obj.columns for lineno, but later
you don`t process this value so it`s return default render
function.  This code repairs this.

Signed-off-by: Dmitry Nechai <nechai.dmitry@gmail.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/xul/staff_client/chrome/content/util/list.js

index 8166016..2d4c33a 100644 (file)
@@ -11,6 +11,8 @@ util.list = function (id) {
 
     this.sub_sorts = [];
 
 
     this.sub_sorts = [];
 
+    this.count_for_display = 0;
+
     if (!this.node) throw('Could not find element ' + id);
     switch(this.node.nodeName) {
         case 'listbox' : 
     if (!this.node) throw('Could not find element ' + id);
     switch(this.node.nodeName) {
         case 'listbox' : 
@@ -1227,13 +1229,27 @@ util.list.prototype = {
                 }
     
                 if (typeof params.map_row_to_column == 'function')  {
                 }
     
                 if (typeof params.map_row_to_column == 'function')  {
+                   if (this.columns[i].id == 'lineno'){
+
+                     label = this.count_for_display.toString();
+                     this.count_for_display++;
+
+                   } else {
     
     
-                    label = params.map_row_to_column(params.row,this.columns[i],this.scratch_data);
-    
+                     label = params.map_row_to_column(params.row,this.columns[i],this.scratch_data);
+
+                   }
                 } else if (typeof this.map_row_to_column == 'function') {
                 } else if (typeof this.map_row_to_column == 'function') {
+                   if (this.columns[i].id == 'lineno'){
+
+                     label = this.count_for_display.toString();
+                     this.count_for_display++;
+
+                   } else {
+
+                     label = this.map_row_to_column(params.row,this.columns[i],this.scratch_data);
     
     
-                    label = this.map_row_to_column(params.row,this.columns[i],this.scratch_data);
-    
+                   }
                 }
                 if (this.columns[i].type == 'checkbox') { treecell.setAttribute('value',label); } else { treecell.setAttribute('label',label ? label : ''); }
                 s += ('treecell = ' + treecell + ' with label = ' + label + '\n');
                 }
                 if (this.columns[i].type == 'checkbox') { treecell.setAttribute('value',label); } else { treecell.setAttribute('label',label ? label : ''); }
                 s += ('treecell = ' + treecell + ' with label = ' + label + '\n');