"offset": 0,
"baseSort": null,
"defaultSort": null,
+ "sortFieldReMap": null,
"constructor": function(/* object */ args) {
dojo.mixin(this, args);
);
},
+ "_remap_sort": function(prepared_sort) {
+ if (this.sortFieldReMap) {
+ return prepared_sort.map(
+ dojo.hitch(
+ this, function(exp) {
+ if (typeof exp == "object") {
+ var key;
+ for (key in exp)
+ break;
+ var newkey = (key in this.sortFieldReMap) ?
+ this.sortFieldReMap[key] : key;
+ var o = {};
+ o[newkey] = exp[key];
+ return o;
+ } else {
+ return (exp in this.sortFieldReMap) ?
+ this.sortFieldReMap[exp] : exp;
+ }
+ }
+ )
+ );
+ } else {
+ return prepared_sort;
+ }
+ },
+
"_prepare_flattener_params": function(req) {
var params = {
"hint": this.fmClass,
params, {
"where": dojo.toJson(req.query),
"slo": dojo.toJson({
- "sort": this._prepare_sort(req.sort),
+ "sort": this._remap_sort(
+ this._prepare_sort(req.sort)
+ ),
"limit": limit,
"offset": offset
})
"columnReordering": true,
"columnPersistKey": null,
"showLoadFilter": false, /* use FlattenerFilterDialog */
- "deferInitialFetch": false,
+ "fetchLock": false,
/* These potential constructor arguments maybe useful to
* FlattenerGrid in their own right, and are passed to
"fmClass": null,
"fmIdentifier": null,
"mapExtras": null,
+ "sortFieldReMap": null,
"defaultSort": null, /* whatever any part of the UI says will
/replace/ this */
"baseSort": null, /* will contains what the columnpicker
"mapClause": (this.mapClause ||
this._cleanMapForStore(this._generateMap())),
"baseSort": this.baseSort,
- "defaultSort": this._mapCPSortFields(sortFields)
+ "defaultSort": this._mapCPSortFields(sortFields),
+ "sortFieldReMap": this.sortFieldReMap
+
}), this.query
);
- if (!this.deferInitialFetch) {
+ if (!this.fetchLock)
this._refresh(true);
- }
// pick up any column label changes
this.columnPicker.reloadStructure();
},
"refresh": function() {
- /* We may never need additional logic here, but I don't
- * want callers to make a habit of calling _ methods directly.
- */
- console.log("here (no surprise)");
+ this.fetchLock = false;
this._refresh(/* isRender */ true);
},
- "_render": function() {
- if(this.domNode.parentNode){
- this.scroller.init(this.attr('rowCount'), this.keepRows, this.rowsPerPage);
- this.prerender();
- if (!this.deferInitialFetch)
- this._fetch(0, true);
- }
+ "_fetch": function() {
+ if (this.fetchLock)
+ return;
+ else
+ return this.inherited(arguments);
},
/* ******** below are methods mostly copied but