/* The callback fired when the OrgUnitFilteringSelect is changed */
function set_grid_query_from_org_selector() {
- /* Naughty: shouldn't use _baseQuery like this, but need to rethink
- multiple competing filtering mechanisms. */
- grid._baseQuery.perm_lib = aou.descendantNodeList(
+ grid.baseQuery.perm_lib = aou.descendantNodeList(
org_selector.attr("value"), /* as id */ true
);
- /* But for the persistent filter UI, this would be grid.refresh() */
+ /* But for the persistent filter UI, this would be grid.filter()
+ and grid.refresh() */
if (filter_semaphore()) /* avoid race between ou selector and other
filter thing */
filter_semaphore_callback();
};
function set_grid_query_from_org_selector() {
- grid.query = {
+ grid.baseQuery = { /* Don't optimize away this assignment. It's
+ important to store this data so that the filter
+ dialog doesn't clobber it later. */
"copy_circ_lib": org_selector.attr("value")
};
+ grid.filter(
+ dojo.mixin(grid.query, grid.baseQuery),
+ true /* re-fetch */
+ );
grid.refresh();
}
"filterWidgetBuilders": null,
"filterSemaphore": null,
"filterSemaphoreCallback": null,
+ "baseQuery": null, /* Good place to mix in data from, say, context
+ OU selectors so that it should get mixed
+ correctly with the generated query from the
+ filter dialog. */
/* These potential constructor arguments may be useful to
* FlattenerGrid in their own right, and are passed to
},
"startup": function() {
- /* Save original query for further filtering later */
- this._baseQuery = dojo.clone(this.query);
+ /* Save original query for further filtering later, unless
+ * we've already defined baseQuery from the outside, in
+ * which case it persists. */
+ if (!this.baseQuery)
+ this.baseQuery = dojo.clone(this.query);
this._addAutoFields();
this.filterUi.onApply = dojo.hitch(
this, function(filter) {
this.filter(
- dojo.mixin(filter, this._baseQuery),
+ dojo.mixin(filter, this.baseQuery),
true /* re-render */
);
}