USER_PERSIST_SETTING : 'ui.grid_columns',
constructor : function (authtoken, persistKey, grid, structure) {
+ var _this = this;
this.grid = grid;
this.persistKey = this.USER_PERSIST_SETTING+'.'+persistKey;
this.authtoken = authtoken || openils.User.authtoken;
this.dialog = this.buildDialog();
this.dialogTable = this.dialog.containerNode.getElementsByTagName('tbody')[0];
- // replace me
- this.onSortChange = function(list) {console.log('onSortChange : ' + list)}
+ // replace: called after any sort changes
+ this.onSortChange = function(list) {console.log('onSortChange()')}
+ // replace: called after user settings are first retrieved
+ this.onLoad = function(opts) {console.log('onLoad()')};
+
+ // internal onload handler
+ this.loaded = false;
+ this._onLoad = function(opts) {_this.loaded = true; _this.onLoad(opts)};
- var _this = this;
this.grid.onHeaderContextMenu = function(e) {
_this.build();
_this.dialog.show();
// this must be added after its parent node is inserted into the DOM.
var ns = new dijit.form.NumberSpinner(
{ constraints : {min : 0, places : 0},
- value : 0,
+ value : cell._sort,
style : 'width:4em',
name : 'sort'
}, ipt3
this.structure[0].cells[0] = displayCells;
this.grid.setStructure(this.structure);
this.grid.update();
-
- if (this.setting.sort && this.setting.sort.length > 0 && this.onSortChange)
- this.onSortChange(this.buildSortList());
},
load : function() {
var _this = this;
openils.Util.addOnLoad(function() {
_this.authtoken = openils.User.authtoken;
- _this.load()
+ _this.load();
});
return;
}
- if(this.setting)
- return this.loadColsFromSetting(this.setting);
+ if(this.setting) {
+ this.loadColsFromSetting(this.setting);
+ this._onLoad({sortFields : this.buildSortList()});
+ return;
+ }
fieldmapper.standardRequest(
['open-ils.actor', 'open-ils.actor.patron.settings.retrieve'],
_this.grid.setStructure(_this.structure);
_this.grid.update();
}
+ _this._onLoad({sortFields : _this.buildSortList()});
}
}
);