s += ('tree = ' + this.node + ' treechildren = ' + treechildren_node + '\n');
s += ('treeitem = ' + treeitem + ' treerow = ' + treerow + '\n');
- if (typeof params.retrieve_row == 'function' || typeof this.retrieve_row == 'function') {
+ obj.put_retrieving_label(treerow);
- obj.put_retrieving_label(treerow);
+ if (typeof params.retrieve_row == 'function' || typeof this.retrieve_row == 'function') {
treerow.addEventListener(
'flesh',
function() {
}
}
} else {
- obj.put_retrieving_label(treerow);
treerow.addEventListener(
'flesh',
function() {
s += ('tree = ' + this.node.nodeName + '\n');
s += ('treeitem = ' + treeitem.nodeName + ' treerow = ' + treerow.nodeName + '\n');
+ obj.put_retrieving_label(treerow);
+
if (typeof params.retrieve_row == 'function' || typeof this.retrieve_row == 'function') {
s += 'found a retrieve_row function\n';
- obj.put_retrieving_label(treerow);
treerow.addEventListener(
'flesh',
function() {
s += 'did not find a retrieve_row function\n';
- obj.put_retrieving_label(treerow);
treerow.addEventListener(
'flesh',
function() {
'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++;
- }
- */
- var create_treecells = treerow.childNodes.length == 0;
for (var i = 0; i < obj.columns.length; i++) {
- var treecell = create_treecells ? document.createElement('treecell') : treerow.childNodes[i];
- if (treecell) {
- if (create_treecells) {
- 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('Error in list.js, put_retrieving_label(): ' + E);
}
'_map_row_to_treecell' : function(params,treerow) {
var obj = this;
var s = '';
- //util.widgets.remove_children(treerow);
- var create_treecells = treerow.childNodes.length == 0;
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 = create_treecells ? document.createElement('treecell') : treerow.childNodes[i];
+ 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;
}
}
if (this.columns[i].type == 'checkbox') { treecell.setAttribute('value',label); } else { treecell.setAttribute('label',label ? label : ''); }
- if (create_treecells) { treerow.appendChild( treecell ); }
s += ('treecell = ' + treecell + ' with label = ' + label + '\n');
}
} else if (typeof params.map_row_to_columns == 'function' || typeof this.map_row_to_columns == 'function') {
}
for (var i = 0; i < labels.length; i++) {
- var treecell = create_treecells ? document.createElement('treecell') : treerow.childNodes[i];
+ 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] : '');
}
- if (create_treecells) { treerow.appendChild( treecell ); }
s += ('treecell = ' + treecell + ' with label = ' + labels[i] + '\n');
}
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 );
}
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 );
}