handle copy status list refresh if the barcode for a row changes.. need to test the...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 8 Oct 2007 20:48:46 +0000 (20:48 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 8 Oct 2007 20:48:46 +0000 (20:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7873 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/list.js
Open-ILS/xul/staff_client/server/circ/copy_status.js

index 42106be..41bc97a 100644 (file)
@@ -429,7 +429,7 @@ util.list.prototype = {
                                                        // if current row is selected, send another select event to re-sync data that the client code fetches on selects
                                                        if ( obj.node.view.selection.isSelected( idx ) ) {
                                                                dump('dispatching select event for on_retrieve for idx = ' + idx + '\n');
-                                                               util.widgets.dispatch('select',params.row_node);
+                                                               util.widgets.dispatch('select',obj.node);
                                                        }
                                                } catch(E) {
                                                        alert('fixme2: ' + E);
@@ -579,7 +579,7 @@ util.list.prototype = {
                                                        // if current row is selected, send another select event to re-sync data that the client code fetches on selects
                                                        if ( obj.node.view.selection.isSelected( idx ) ) {
                                                                dump('dispatching select event for on_retrieve for idx = ' + idx + '\n');
-                                                               util.widgets.dispatch('select',params.row_node);
+                                                               util.widgets.dispatch('select',obj.node);
                                                        }
                                                } catch(E) {
                                                        alert('fixme2: ' + E);
@@ -653,6 +653,8 @@ util.list.prototype = {
 
                setTimeout( function() { obj.auto_retrieve(); }, 0 );
 
+        JSAN.use('util.widgets'); util.widgets.dispatch('select',obj.node);
+
                return params;
        },
 
@@ -811,7 +813,7 @@ util.list.prototype = {
                                                params.row = row;
                                                obj._map_row_to_listcell(params,listitem);
                                                obj.node.appendChild( listitem );
-                                               util.widgets.dispatch('select',params.row_node);
+                                               util.widgets.dispatch('select',obj.node);
                                        }
 
                                        if (typeof params.retrieve_row == 'function') {
index b08c9f0..1d74c7d 100644 (file)
@@ -13,7 +13,7 @@ circ.copy_status = function (params) {
 
 circ.copy_status.prototype = {
        'selection_list' : [],
-       'list_barcode_map' : {},
+       'list_copyid_map' : {},
 
        'init' : function( params ) {
 
@@ -1025,15 +1025,23 @@ circ.copy_status.prototype = {
                                        if (!refresh) {
                                                var nparams = obj.list.append(params);
                                                if (!document.getElementById('trim_list').checked) {
-                                                       if (typeof obj.list_barcode_map[barcode] == 'undefined') obj.list_barcode_map[barcode] =[];
-                                                       obj.list_barcode_map[barcode].push(nparams);
+                                                       if (typeof obj.list_copyid_map[details.copy.id()] == 'undefined') obj.list_copyid_map[details.copy.id()] =[];
+                                                       obj.list_copyid_map[details.copy.id()].push(nparams);
                                                }
                                        } else {
                                                if (!document.getElementById('trim_list').checked) {
-                                                       for (var i = 0; i < obj.list_barcode_map[barcode].length; i++) {
-                                                               params.my_node = obj.list_barcode_map[barcode][i].my_node;
-                                                               obj.list.refresh_row(params);
-                                                       }
+                            if (typeof obj.list_copyid_map[details.copy.id()] != 'undefined') {
+                                for (var i = 0; i < obj.list_copyid_map[details.copy.id()].length; i++) {
+                                    if (typeof obj.list_copyid_map[details.copy.id()][i] == 'undefined') {
+                                        obj.list.append(params);
+                                    } else {
+                                        params.my_node = obj.list_copyid_map[details.copy.id()][i].my_node;
+                                        obj.list.refresh_row(params);
+                                    }
+                                }
+                            } else {
+                                                           obj.list.append(params);
+                            }
                                                } else {
                                                        obj.list.append(params);
                                                }