delete cell.width;
}
displayCells.push(cell);
+
} else {
cell._visible = false;
delete cell.width;
this.grid.setStructure(this.structure);
this.grid.update();
- if (sortUpdated && this.onSortChange) {
- var sortList = this.cells.filter(
- function(cella) { return cella._sort > 0 }).sort(
- function(a, b) { if (a._sort < b._sort) return -1; return 1; });
+ if (sortUpdated && this.onSortChange)
this.onSortChange(this.buildSortList());
- }
- if(persist)
- this.persist(true);
+ if (persist) this.persist(true);
},
// extract cells that have sorting applied, order lowest to highest
);
},
- _loadColsFromSetting : function(setting) {
+ loadColsFromSetting : function(setting) {
var _this = this;
this.setting = setting;
var displayCells = [];
- // new component, existing settings will not have this
+ // new component, existing settings may not have this
if (!setting.sort) setting.sort = [];
dojo.forEach(setting.columns,
if (cell) {
cell._visible = true;
displayCells.push(cell);
+
if(setting.auto.indexOf(cell.field) > -1) {
cell.width = 'auto';
} else {
delete cell.width;
}
cell._sort = setting.sort.indexOf(cell.field) + 1;
+
} else {
console.log('Unknown setting column '+col+'. Ignoring...');
}
}
if(this.setting)
- return this._loadColsFromSetting(this.setting);
+ return this.loadColsFromSetting(this.setting);
fieldmapper.standardRequest(
['open-ils.actor', 'open-ils.actor.patron.settings.retrieve'],
oncomplete: function(r) {
var set = openils.Util.readResponse(r);
if(set) {
- _this._loadColsFromSetting(set);
+ _this.loadColsFromSetting(set);
} else {
_this.grid.setStructure(_this.structure);
_this.grid.update();