[open-ils-commits] r16688 - branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jun 11 17:16:39 EDT 2010
Author: phasefx
Date: 2010-06-11 17:16:33 -0400 (Fri, 11 Jun 2010)
New Revision: 16688
Modified:
branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/list.js
Log:
backporting changeset 16687 with harmless bits of 14391 and 15222 sneaking in; hoping to help with https://bugs.launchpad.net/evergreen/+bug/567505
Modified: branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/list.js
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/list.js 2010-06-11 20:32:43 UTC (rev 16687)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/list.js 2010-06-11 21:16:33 UTC (rev 16688)
@@ -393,9 +393,9 @@
s += ('tree = ' + this.node + ' treechildren = ' + treechildren_node + '\n');
s += ('treeitem = ' + treeitem + ' treerow = ' + treerow + '\n');
+ obj.put_retrieving_label(treerow);
+
if (typeof params.retrieve_row == 'function' || typeof this.retrieve_row == 'function') {
-
- obj.put_retrieving_label(treerow);
treerow.addEventListener(
'flesh',
function() {
@@ -457,7 +457,6 @@
);
*/
} else {
- obj.put_retrieving_label(treerow);
treerow.addEventListener(
'flesh',
function() {
@@ -540,9 +539,10 @@
s += ('tree = ' + this.node + '\n');
s += ('treeitem = ' + treeitem + ' treerow = ' + treerow + '\n');
+ obj.put_retrieving_label(treerow);
+
if (typeof params.retrieve_row == 'function' || typeof this.retrieve_row == 'function') {
- obj.put_retrieving_label(treerow);
treerow.addEventListener(
'flesh',
function() {
@@ -604,7 +604,6 @@
);
*/
} else {
- obj.put_retrieving_label(treerow);
treerow.addEventListener(
'flesh',
function() {
@@ -654,23 +653,16 @@
'put_retrieving_label' : function(treerow) {
var obj = this;
try {
- /*
- var cols_idx = 0;
- dump('put_retrieving_label. columns = ' + js2JSON(obj.columns) + '\n');
- while( obj.columns[cols_idx] && obj.columns[cols_idx].hidden && obj.columns[cols_idx].hidden == 'true') {
- dump('\t' + cols_idx);
- var treecell = document.createElement('treecell');
- treerow.appendChild(treecell);
- cols_idx++;
- }
- */
for (var i = 0; i < obj.columns.length; i++) {
- var treecell = document.createElement('treecell'); treecell.setAttribute('label',document.getElementById('offlineStrings').getString('list.row_retrieving'));
- treerow.appendChild(treecell);
+ var treecell;
+ if (typeof treerow.childNodes[i] == 'undefined') {
+ treecell = document.createElement('treecell');
+ treerow.appendChild(treecell);
+ } else {
+ treecell = treerow.childNodes[i];
+ }
+ treecell.setAttribute('label',document.getElementById('offlineStrings').getString('list.row_retrieving'));
}
- /*
- dump('\t' + cols_idx + '\n');
- */
} catch(E) {
alert(E);
}
@@ -879,22 +871,29 @@
'_map_row_to_treecell' : function(params,treerow) {
var obj = this;
var s = '';
- util.widgets.remove_children(treerow);
if (typeof params.map_row_to_column == 'function' || typeof this.map_row_to_column == 'function') {
for (var i = 0; i < this.columns.length; i++) {
- var treecell = document.createElement('treecell');
+ var treecell;
+ if (typeof treerow.childNodes[i] == 'undefined') {
+ treecell = document.createElement('treecell');
+ treerow.appendChild( treecell );
+ } else {
+ treecell = treerow.childNodes[i];
+ }
+
+ if ( this.columns[i].editable == false ) { treecell.setAttribute('editable','false'); }
var label = '';
+
+ // What skip columns is doing is rendering the treecells as blank/empty
if (params.skip_columns && (params.skip_columns.indexOf(i) != -1)) {
treecell.setAttribute('label',label);
- treerow.appendChild( treecell );
s += ('treecell = ' + treecell + ' with label = ' + label + '\n');
continue;
}
if (params.skip_all_columns_except && (params.skip_all_columns_except.indexOf(i) == -1)) {
treecell.setAttribute('label',label);
- treerow.appendChild( treecell );
s += ('treecell = ' + treecell + ' with label = ' + label + '\n');
continue;
}
@@ -908,8 +907,7 @@
label = this.map_row_to_column(params.row,this.columns[i]);
}
- treecell.setAttribute('label',label ? label : '');
- treerow.appendChild( treecell );
+ if (this.columns[i].type == 'checkbox') { treecell.setAttribute('value',label); } else { treecell.setAttribute('label',label ? label : ''); }
s += ('treecell = ' + treecell + ' with label = ' + label + '\n');
}
} else if (typeof params.map_row_to_columns == 'function' || typeof this.map_row_to_columns == 'function') {
@@ -926,9 +924,19 @@
}
for (var i = 0; i < labels.length; i++) {
- var treecell = document.createElement('treecell');
- treecell.setAttribute('label',typeof labels[i] == 'string' || typeof labels[i] == 'number' ? labels[i] : '');
- treerow.appendChild( treecell );
+ var treecell;
+ if (typeof treerow.childNodes[i] == 'undefined') {
+ treecell = document.createElement('treecell');
+ treerow.appendChild(treecell);
+ } else {
+ treecell = treerow.childNodes[i];
+ }
+ if ( this.columns[i].editable == false ) { treecell.setAttribute('editable','false'); }
+ if ( this.columns[i].type == 'checkbox') {
+ treecell.setAttribute('value', labels[i]);
+ } else {
+ treecell.setAttribute('label',typeof labels[i] == 'string' || typeof labels[i] == 'number' ? labels[i] : '');
+ }
s += ('treecell = ' + treecell + ' with label = ' + labels[i] + '\n');
}
@@ -1045,7 +1053,14 @@
var treeitem = this.treechildren.childNodes[i];
var treerow = treeitem.firstChild;
for (var j = 0; j < treerow.childNodes.length; j++) {
- row[ obj.columns[j].id ] = treerow.childNodes[j].getAttribute('label');
+ if (typeof obj.columns[j] == 'undefined') {
+ dump('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n');
+ dump('_dump_tree_with_keys @ ' + location.href + '\n');
+ dump('\ttreerow.childNodes.length='+treerow.childNodes.length+' j='+j+' obj.columns.length='+obj.columns.length+'\n');
+ debugger;
+ } else {
+ row[ obj.columns[j].id ] = treerow.childNodes[j].getAttribute('label');
+ }
}
dump.push( row );
}
@@ -1197,8 +1212,15 @@
for (var j = 0; j < treerow.childNodes.length; j++) {
var value = treerow.childNodes[j].getAttribute('label');
if (params.skip_hidden_columns) if (obj.node.treeBoxObject.columns.getColumnAt(j).element.getAttribute('hidden') == 'true') continue;
- var id = obj.columns[j].id; if (params.labels_instead_of_ids) id = obj.columns[j].label;
- row[ id ] = value;
+ if (typeof obj.columns[j] == 'undefined') {
+ dump('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n');
+ dump('_dump_tree_selection_with_keys @ ' + location.href + '\n');
+ dump('\ttreerow.childNodes.length='+treerow.childNodes.length+' j='+j+' obj.columns.length='+obj.columns.length+'\n');
+ debugger;
+ } else {
+ var id = obj.columns[j].id; if (params.labels_instead_of_ids) id = obj.columns[j].label;
+ row[ id ] = value;
+ }
}
dump.push( row );
}
More information about the open-ils-commits
mailing list