this.node.appendChild(treecols);
this.treecols = treecols;
+ var check_for_id_collisions = {};
for (var i = 0; i < this.columns.length; i++) {
var treecol = document.createElement('treecol');
for (var j in this.columns[i]) {
- treecol.setAttribute(j,this.columns[i][j]);
+ var value = this.columns[i][j];
+ if (j=='id') {
+ if (typeof check_for_id_collisions[value] == 'undefined') {
+ check_for_id_collisions[value] = true;
+ } else {
+ // Column id's are important for sorting and saving list configuration. Collisions started happening because
+ // we were using field names as id's, and then later combining column definitions for multiple objects that
+ // shared field names. The downside to this sort of automatic collision prevention is that these generated
+ // id's can change as we add and remove columns, possibly breaking saved list configurations.
+ dump('Column collision with id = ' + value + ', renaming to ');
+ value = value + '_collision_' + i;
+ dump(value + '\n');
+ }
+ }
+ treecol.setAttribute(j,value);
}
treecols.appendChild(treecol);
if (this.columns[i].type == 'checkbox') {
'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_payment_ts(), "%{localized}" ); }
},
{
- 'persist' : 'hidden width ordinal', 'id' : 'xact_start', 'label' : commonStrings.getString('staff.mbts_xact_start_label'), 'flex' : 1,
+ 'persist' : 'hidden width ordinal', 'id' : 'mbts_xact_start', 'label' : commonStrings.getString('staff.mbts_xact_start_label'), 'flex' : 1,
'sort_type' : 'date',
'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_start() ? util.date.formatted_date( my.mbts.xact_start(), "%{localized}" ) : ""; }
},
{
- 'persist' : 'hidden width ordinal', 'id' : 'xact_finish', 'label' : commonStrings.getString('staff.mbts_xact_finish_label'), 'flex' : 1,
+ 'persist' : 'hidden width ordinal', 'id' : 'mbts_xact_finish', 'label' : commonStrings.getString('staff.mbts_xact_finish_label'), 'flex' : 1,
'sort_type' : 'date',
'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_finish() ? util.date.formatted_date( my.mbts.xact_finish(), "%{localized}" ) : ""; }
},
'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.suffix(); }
},
{
- 'persist' : 'hidden width ordinal', 'id' : 'alert_message', 'label' : commonStrings.getString('staff.au_alert_message_label'), 'flex' : 1,
+ 'persist' : 'hidden width ordinal', 'id' : 'au_alert_message', 'label' : commonStrings.getString('staff.au_alert_message_label'), 'flex' : 1,
'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.alert_message(); }
},
{
'sort_type' : 'number'
},
{
- 'persist' : 'hidden width ordinal', 'id' : 'create_date', 'label' : commonStrings.getString('staff.au_create_date_label'), 'flex' : 1,
+ 'persist' : 'hidden width ordinal', 'id' : 'au_create_date', 'label' : commonStrings.getString('staff.au_create_date_label'), 'flex' : 1,
'sort_type' : 'date',
'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.au.create_date(), "%{localized}" ); }
},