1 if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
2 dojo.provide("openils.widget.FlattenerGrid");
4 dojo.requireLocalization("openils.widget", "FlattenerGrid");
6 dojo.require("DojoSRF");
7 dojo.require("dojox.grid.DataGrid");
8 dojo.require("openils.FlattenerStore");
9 dojo.require("openils.PermaCrud");
10 dojo.require("openils.widget.GridColumnPicker");
11 dojo.require("openils.widget.EditDialog"); /* includes EditPane */
12 dojo.require("openils.widget._GridHelperColumns");
13 dojo.require("openils.XUL");
16 "openils.widget.FlattenerGrid",
17 [dojox.grid.DataGrid, openils.widget._GridHelperColumns], {
18 /* Later, might think about whether this should really be an
19 * "object" property like this or a "class" one (in dojo speak,
20 * since those terms don't really apply in pure JS)... */
21 "localeStrings": dojo.i18n.getLocalization(
22 "openils.widget", "FlattenerGrid"
25 /* These potential constructor arguments are useful to
26 * FlattenerGrid in their own right */
27 "columnReordering": true,
28 "columnPersistKey": null,
29 "autoCoreFields": false,
30 "autoCoreFieldsUnsorted": false,
31 "autoCoreFieldsFilter": false,
32 "autoFieldFields": null,
33 "autoFieldFieldsUnsorted": null, /* array, subset of autoFieldFields */
34 "showLoadFilter": false, /* use FlattenerFilter(Dialog|Pane) */
35 "filterAlwaysInDiv": null, /* use FlattenerFilterPane and put its
36 content in this HTML element */
38 "filterInitializers": null,
39 "filterWidgetBuilders": null,
40 "filterSemaphore": null,
41 "filterSemaphoreCallback": null,
42 "baseQuery": null, /* Good place to mix in data from, say, context
43 OU selectors so that it should get mixed
44 correctly with the generated query from the
46 "savedFiltersInterface": null,
48 /* These potential constructor arguments may be useful to
49 * FlattenerGrid in their own right, and are passed to
54 "sortFieldReMap": null,
55 "defaultSort": null, /* whatever any part of the UI says will
57 "baseSort": null, /* will contains what the columnpicker
58 dictates, and precedes whatever the column
61 /* These potential constructor arguments are for functionality
62 * copied from AutoGrid */
63 "editOnEnter": false, /* also implies edit-on-dblclick */
64 "editStyle": "dialog", /* "dialog" or "pane" */
65 "requiredFields": null, /* affects create/edit dialogs */
66 "suppressEditFields": null, /* affects create/edit dialogs */
67 "suppressFilterFields": null, /* affects filter dialog */
69 /* _generateMap() lives to interpret the attributes of the
70 * FlattenerGrid dijit itself plus those definined in
74 * <th field="foo" ...>
75 * to build the map to hand to the FlattenerStore, which in turn
76 * uses it to query the flattener service.
78 "_generateMap": function() {
79 var map = this.mapClause = {};
80 var fields = this.structure[0].cells[0];
82 /* These are the fields defined in thead -> tr -> [th,th,...].
83 * For purposes of building the map, where each field has
84 * three boolean attributes "display", "sort" and "filter",
85 * assume "display" is always true for these.
86 * That doesn't mean that at the UI level we can't hide a
89 * If you need extra fields in the map for which display
90 * should *not* be true, use mapExtras.
93 fields, function(field) {
94 if (field.field.match(/^\+/))
95 return; /* special fields e.g. checkbox/line # */
99 "filter": (field.ffilter || false),
101 "path": field.fpath || field.field
103 /* The following attribute is not for the flattener
104 * service's benefit, but for other uses. We capture
105 * the hardcoded <th> value (the header label) if any.*/
107 map[field.field]._label = field.name;
111 if (this.mapExtras) {
112 /* It's not particularly useful to add simple fields, i.e.
113 * circ_lib: "circ_lib.name"
114 * to mapExtras, because by convention used elsewhere in
115 * Flattener, that gives all attributes, including
116 * display, a true value. Still, be consistent to avoid
119 for (var key in this.mapExtras) {
120 if (typeof this.mapExtras[key] != "object") {
121 this.mapExtras[key] = {
122 "path": this.mapExtras[key],
129 dojo.mixin(map, this.mapExtras);
132 /* Do this now, since we don't want a silently added
133 * identifier attribute in the terminii list (see its uses). */
134 this._calculateMapTerminii();
135 this._supplementHeaderNames();
137 /* make sure we always have a field for fm identifier */
138 if (!map[this.fmIdentifier]) {
139 map[this.fmIdentifier] = {
140 "path": this.fmIdentifier,
141 "display": true, /* Flattener displays it to us,
142 but we don't display to user. */
151 "_cleanMapForStore": function(map) {
152 var clean = dojo.clone(map);
154 for (var column in clean) {
155 openils.Util.objectProperties(clean[column]).filter(
156 function(k) { return k.match(/^_/); }
158 function(k) { delete clean[column][k]; }
165 /* Given the hint of a class to start at, follow path to the end
166 * and return information on the last field. */
167 "_followPathToEnd": function(hint, path, allow_selector_backoff) {
168 function _fm_is_selector_for_class(h, field) {
169 var cl = fieldmapper.IDL.fmclasses[h];
170 return (cl.field_map[cl.pkey].selector == field);
173 var last_field, last_hint;
174 var orig_path = dojo.clone(path);
175 var field, field_def;
177 while (field = path.shift()) {
178 /* XXX this assumes we have the whole IDL loaded. I
179 * guess we could teach this to work by loading classes
180 * on demand when we don't have the whole IDL loaded. */
182 fieldmapper.IDL.fmclasses[hint].field_map[field];
185 /* This can be ok in some cases. Columns following
186 * IDL paths involving links with a nonempty "map"
187 * attribute can be used for display only (no
188 * sort, no filter). */
190 "Lost our way in IDL at hint " + hint +
191 ", field " + field + "; may be ok"
196 if (field_def["class"]) {
200 hint = field_def["class"];
201 } else if (path.length) {
202 /* There are more fields left but we can't follow
203 * the chain via IDL any further. */
205 "_calculateMapTerminii can't parse path " +
206 orig_path + " (at " + field + ")"
211 var datatype = field_def.datatype;
212 var indirect = false;
213 /* If allowed, back off the last field in the path if it's a
214 * selector for its class, because the preceding field will be
215 * a better thing to hand to AutoFieldWidget.
217 if (orig_path.length > 1 && allow_selector_backoff &&
218 _fm_is_selector_for_class(hint, field_def.name)) {
224 field = field_def.name;
230 "label": field_def.label,
231 "datatype": datatype,
236 /* The FlattenerStore doesn't need this, but it has at least two
237 * uses: 1) FlattenerFilterDialog, 2) setting column header labels
240 * To call these 'Terminii' can be misleading. In certain
241 * (actually probably common) cases, they won't really be the last
242 * field in a path, but the next-to-last. Read on. */
243 "_calculateMapTerminii": function() {
244 this.mapTerminii = [];
245 for (var column in this.mapClause) {
246 var end = this._followPathToEnd(
248 this.mapClause[column].path.split(/\./),
249 true /* allow selector backoff */
253 var terminus = dojo.mixin(
255 "simple_name": column,
256 "isfilter": this.mapClause[column].filter
259 if (this.mapClause[column]._label)
260 terminus.label = this.mapClause[column]._label;
262 this.mapTerminii.push(terminus);
266 "_supplementHeaderNames": function() {
267 /* If we didn't give a particular header cell
268 * (<th>) a display name (the innerHTML of that <th>), then
269 * use the IDL to provide the label of the terminus of the
270 * flattener path for that column. It may be better than using
271 * the raw field name. */
273 this.structure[0].cells[0].forEach(
276 header.name = self.mapTerminii.filter(
278 return t.simple_name == header.field;
286 "_columnOrderingAndLabels": function() {
290 this.views.views[0].structure.cells[0].forEach(
292 if (!c.field.match(/^\+/)) {
294 columns.push(c.field);
299 return {"labels": labels, "columns": columns};
302 "_getAutoFieldFields": function(fmclass, path) {
303 var field_list = dojo.clone(
304 fieldmapper.IDL.fmclasses[fmclass].fields)
306 function(f) { return !f.virtual && f.datatype != "link"; }
309 /* Sort fields unless the path is named in grid property
310 * 'autoFieldFieldsUnsorted' (array). */
311 if (!dojo.isArray(this.autoFieldFieldsUnsorted) ||
312 this.autoFieldFieldsUnsorted.indexOf(path) == -1) {
313 field_list = field_list.sort(
314 function(a, b) { return a.label > b.label ? 1 : -1; }
321 /* Take our core class (this.fmClass) and add table columns for
322 * any field we don't already have covered by actual hard-coded
324 "_addAutoCoreFields": function() {
325 var cell_list = this.structure[0].cells[0];
326 var fields = dojo.clone(
327 fieldmapper.IDL.fmclasses[this.fmClass].fields
330 if (!this.autoCoreFieldsUnsorted) {
331 fields = fields.sort(
332 function(a, b) { return a.label > b.label ? 1 : -1; }
337 fields, dojo.hitch(this, function(f) {
338 if (f.datatype == "link" || f.virtual)
341 if (cell_list.filter(
343 if (!c.fpath) return false;
344 return c.fpath.split(/\./)[0] == f.name;
353 "ffilter": this.autoCoreFieldsFilter
359 "_addAutoFieldFields": function(paths) {
364 paths, function(path) {
365 /* The beginning is the end. */
366 var beginning = self._followPathToEnd(
367 self.fmClass, path.split(/\./), false
373 self._getAutoFieldFields(
374 beginning.fmClass, path
378 path + "." + field.name;
380 new RegExp("^" + would_be_path);
381 if (!self.structure[0].cells[0].filter(
384 c.fpath.match(wbp_re);
387 self.structure[0].cells[0].push({
388 "field": "AUTO_" + beginning.name +
390 "name": beginning.label + " - " +
393 "fpath": would_be_path,
404 "_addAutoFields": function() {
405 if (this.autoCoreFields)
406 this._addAutoCoreFields();
408 if (dojo.isArray(this.autoFieldFields))
409 this._addAutoFieldFields(this.autoFieldFields);
411 this.setStructure(this.structure);
414 "constructor": function(args) {
415 dojo.mixin(this, args);
417 this.fmIdentifier = this.fmIdentifier ||
418 fieldmapper.IDL.fmclasses[this.fmClass].pkey;
420 this.overrideEditWidgets = {};
421 this.overrideEditWidgetClass = {};
422 this.overrideWidgetArgs = {};
425 "startup": function() {
426 /* Save original query for further filtering later, unless
427 * we've already defined baseQuery from the outside, in
428 * which case it persists. */
430 this.baseQuery = dojo.clone(this.query);
432 this._addAutoFields();
434 this._startupGridHelperColumns();
438 if (!this.columnPicker) {
440 new openils.widget.GridColumnPicker(
441 null, this.columnPersistKey, this);
442 this.columnPicker.onLoad = dojo.hitch(
443 this, function(opts) { this._finishStartup(opts.sortFields) });
445 this.columnPicker.onSortChange = dojo.hitch(this,
446 /* directly after, this.update() is called by the
447 column picker, causing a re-fetch */
449 this.store.baseSort = this._mapCPSortFields(fields)
453 this.columnPicker.load();
456 this.inherited(arguments);
458 this.focus.focusHeader = function() {
459 /* This prevents an unwanted automatic scroll of the
460 * user's browser to the header row of the grid whenever
461 * you touch the horizontal scrollbar. The prevented
462 * behavior was absolutely hateful, since if your grid was
463 * larger than your window, touching the horizontal scroll-
464 * bar meant scrolling up so that the same scrollbar was
465 * now off your screen, and you could not manipulate it.
467 * There may be a more targeted way to fix the problem,
468 * but this will do. */
469 console.log("focusHeader() suppressed");
473 "canSort": function(idx, skip_structure /* API abuse */) {
474 var initial = this.inherited(arguments);
476 /* idx is one-based instead of zero-based for a reason. */
477 var view_idx = Math.abs(idx) - 1;
480 this.views.views[0].structure.cells[0][view_idx].fsort
484 /* Maps ColumnPicker sort fields to the correct format.
485 If no sort fields specified, falls back to defaultSort */
486 "_mapCPSortFields": function(sortFields) {
487 var sort = this.defaultSort;
488 if (sortFields.length) {
489 sort = sortFields.map(function(f) {
491 a[f.field] = f.direction;
498 "_finishStartup": function(sortFields) {
500 this._setStore( /* Seriously, let's leave this as _setStore. */
501 new openils.FlattenerStore({
502 "fmClass": this.fmClass,
503 "fmIdentifier": this.fmIdentifier,
504 "mapClause": this._cleanMapForStore(this.mapClause),
505 "baseSort": this.baseSort,
506 "defaultSort": this._mapCPSortFields(sortFields),
507 "sortFieldReMap": this.sortFieldReMap
512 // pick up any column label changes
513 this.columnPicker.reloadStructure();
518 this._showing_create_pane = false;
520 if (this.editOnEnter)
521 this._applyEditOnEnter();
522 else if (this.singleEditStyle)
523 this._applySingleEditStyle();
525 /* Like AutoGrid's paginator, but we'll never have Back/Next
526 * links. Just a place to hold misc links */
531 "_setupLinks": function() {
532 this.linkHolder = new dijit.layout.ContentPane();
533 dojo.place(this.linkHolder.domNode, this.domNode, "before");
535 if (this.showLoadFilter) {
536 var which_filter_ui = this.filterAlwaysInDiv ?
537 "FlattenerFilterPane" : "FlattenerFilterDialog";
539 dojo.require("openils.widget." + which_filter_ui);
541 new openils.widget[which_filter_ui]({
542 "fmClass": this.fmClass,
543 "mapTerminii": this.mapTerminii,
544 "useDiv": this.filterAlwaysInDiv,
545 "initializers": this.filterInitializers,
546 "widgetBuilders": this.filterWidgetBuilders,
547 "suppressFilterFields": this.suppressFilterFields,
548 "savedFiltersInterface": this.savedFiltersInterface
551 this.filterUi.onApply = dojo.hitch(
552 this, function(filter) {
554 dojo.mixin(filter, this.baseQuery),
560 this.filterUi.startup();
562 if (this.filterSemaphore && this.filterSemaphore()) {
563 if (this.filterSemaphoreCallback)
564 this.filterSemaphoreCallback();
566 if (!this.filterAlwaysInDiv) {
567 new dijit.form.Button(
569 "label": "Filter", /* XXX i18n */
570 "onClick": dojo.hitch(
571 this, function() { this.filterUi.show(); }
574 dojo.create("span", null, this.linkHolder.domNode)
580 "refresh": function() {
581 this.fetchLock = false;
582 this._refresh(/* isRender */ true);
585 "_fetch": function() {
589 return this.inherited(arguments);
592 /* ******** below are methods mostly copied but
593 * slightly changed from AutoGrid ******** */
595 "_applySingleEditStyle": function() {
596 this.onMouseOverRow = function(e) {};
597 this.onMouseOutRow = function(e) {};
598 this.onCellFocus = function(cell, rowIndex) {
599 this.selection.deselectAll();
600 this.selection.select(this.focus.rowIndex);
604 /* capture keydown and launch edit dialog on enter */
605 "_applyEditOnEnter": function() {
606 this._applySingleEditStyle();
609 this, "onRowDblClick", function(e) {
610 if (this.editStyle == "pane")
612 this.selection.getFirstSelected(),
616 this._drawEditDialog(
617 this.selection.getFirstSelected(),
624 this, "onKeyDown", function(e) {
625 if (e.keyCode == dojo.keys.ENTER) {
626 this.selection.deselectAll();
627 this.selection.select(this.focus.rowIndex);
628 if (this.editStyle == "pane")
630 this.selection.getFirstSelected(),
634 this._drawEditDialog(
635 this.selection.getFirstSelected(),
643 "_makeEditPane": function(storeItem, rowIndex, onPostSubmit, onCancel) {
645 var fmObject = (new openils.PermaCrud()).retrieve(
647 this.store.getIdentity(storeItem)
650 var pane = new openils.widget.EditPane({
651 "fmObject": fmObject,
652 "hideSaveButton": this.editReadOnly,
653 "readOnly": this.editReadOnly,
654 "overrideWidgets": this.overrideEditWidgets,
655 "overrideWidgetClass": this.overrideEditWidgetClass,
656 "overrideWidgetArgs": this.overrideWidgetArgs,
657 "disableWidgetTest": this.disableWidgetTest,
658 "requiredFields": this.requiredFields,
659 "suppressFields": this.suppressEditFields,
660 "onPostSubmit": function() {
661 /* ask the store to call flattener specially to get
662 * the flat row related to only this fmobj */
663 grid.store.loadItem({"force": true, "item": storeItem});
665 if (grid.onPostUpdate)
666 grid.onPostUpdate(storeItem, rowIndex);
671 grid.views.views[0].getCellNode(
680 "onCancel": function() {
683 grid.views.views[0].getCellNode(
693 if (typeof this.editPaneOnSubmit == "function")
694 pane.onSubmit = this.editPaneOnSubmit;
696 pane.fieldOrder = this.fieldOrder;
697 pane.mode = "update";
701 "_makeCreatePane": function(onPostSubmit, onCancel) {
703 var pane = new openils.widget.EditPane({
704 "fmClass": this.fmClass,
705 "overrideWidgets": this.overrideEditWidgets,
706 "overrideWidgetClass": this.overrideEditWidgetClass,
707 "overrideWidgetArgs": this.overrideWidgetArgs,
708 "disableWidgetTest": this.disableWidgetTest,
709 "requiredFields": this.requiredFields,
710 "suppressFields": this.suppressEditFields,
711 "onPostSubmit": function(req, cudResults) {
712 var fmObject = cudResults[0];
713 if (grid.onPostCreate)
714 grid.onPostCreate(fmObject);
716 grid.store.fetchItemByIdentity({
717 "identity": fmObject[grid.fmIdentifier](),
718 "onItem": function(item) {
719 grid.store.onNew(item);
727 grid.selection.select(grid.rowCount - 1);
728 grid.views.views[0].getCellNode(
736 onPostSubmit(fmObject);
738 "onCancel": function() { if (onCancel) onCancel(); }
741 if (typeof this.createPaneOnSubmit == "function")
742 pane.onSubmit = this.createPaneOnSubmit;
743 pane.fieldOrder = this.fieldOrder;
744 pane.mode = "create";
749 * Creates an EditPane with a copy of the data from the provided store
750 * item for cloning said item
751 * @param {Object} storeItem Dojo data item
752 * @param {Number} rowIndex The Grid row index of the item to be cloned
753 * @param {Function} onPostSubmit Optional callback for post-submit behavior
754 * @param {Function} onCancel Optional callback for clone cancelation
755 * @return {Object} The clone EditPane
757 "_makeClonePane": function(storeItem,rowIndex,onPostSubmit,onCancel) {
758 var clonePane = this._makeCreatePane(onPostSubmit, onCancel);
759 var origPane = this._makeEditPane(storeItem, rowIndex);
763 origPane.fieldList, function(field) {
764 if (field.widget.widget.attr('disabled'))
767 var w = clonePane.fieldList.filter(
768 function(i) { return (i.name == field.name) }
772 w.widget.baseWidgetValue(field.widget.widget.attr('value'));
775 w.widget.onload = function() {
776 w.widget.baseWidgetValue(
777 field.widget.widget.attr('value')
787 "_drawEditDialog": function(storeItem, rowIndex) {
788 var done = dojo.hitch(this, function() { this.hideDialog(); });
789 var pane = this._makeEditPane(storeItem, rowIndex, done, done);
790 this.editDialog = new openils.widget.EditDialog({editPane:pane});
791 this.editDialog.startup();
792 this.editDialog.show();
796 * Generates an EditDialog for object creation and displays it to the user
798 "showCreateDialog": function() {
799 var done = dojo.hitch(this, function() { this.hideDialog(); });
800 var pane = this._makeCreatePane(done, done);
801 this.editDialog = new openils.widget.EditDialog({editPane:pane});
802 this.editDialog.startup();
803 this.editDialog.show();
806 "_drawEditPane": function(storeItem, rowIndex) {
807 var done = dojo.hitch(this, function() { this.hidePane(); });
809 dojo.style(this.domNode, "display", "none");
811 this.editPane = this._makeEditPane(storeItem, rowIndex, done, done);
812 this.editPane.startup();
813 dojo.place(this.editPane.domNode, this.domNode, "before");
816 this.onEditPane(this.editPane);
819 "showClonePane": function(onPostSubmit) {
820 var done = dojo.hitch(this, function() { this.hidePane(); });
821 var row = this.getFirstSelectedRow();
827 postSubmit = dojo.hitch(
828 this, function(result) {
829 onPostSubmit(this.getItem(row), result);
837 dojo.style(this.domNode, "display", "none");
838 this.editPane = this._makeClonePane(
839 this.getItem(row), row, postSubmit, done
841 dojo.place(this.editPane.domNode, this.domNode, "before");
843 this.onEditPane(this.editPane);
846 "showCreatePane": function() {
847 if (this._showing_create_pane)
849 this._showing_create_pane = true;
851 var done = dojo.hitch(
853 this._showing_create_pane = false;
858 dojo.style(this.domNode, "display", "none");
860 this.editPane = this._makeCreatePane(done, done);
861 this.editPane.startup();
863 dojo.place(this.editPane.domNode, this.domNode, "before");
866 this.onEditPane(this.editPane);
869 "hideDialog": function() {
870 this.editDialog.hide();
871 this.editDialog.destroy();
872 delete this.editDialog;
876 "hidePane": function() {
877 this.domNode.parentNode.removeChild(this.editPane.domNode);
878 this.editPane.destroy();
879 delete this.editPane;
880 dojo.style(this.domNode, "display", "block");
884 "deleteSelected": function() {
887 this.getSelectedItems().forEach(
889 var fmobj = new fieldmapper[self.fmClass]();
890 fmobj[self.fmIdentifier](
891 self.store.getIdentity(item)
893 (new openils.PermaCrud()).eliminate(
895 "oncomplete": function() {
896 self.store.deleteItem(item);
904 "getSelectedIDs": function() {
905 return this.getSelectedItems().map(
908 function(item) { return this.store.getIdentity(item); }
913 /* Return true if every row known to the grid is selected. Code
914 * that calls this function will do so when it thinks the user
915 * might actually mean "select everything this grid could show"
916 * even though we don't necessarily know (and the user hasn't
917 * necessarily noticed) whether the grid has been scrolled as far
918 * down as possible and all the possible results have been
919 * fetched by the grid's store. */
920 "everythingSeemsSelected": function() {
922 "[name=autogrid.selector]", this.domNode
924 function(c) { return (!c.disabled && !c.checked) }
928 "downloadCSV": function(filename_prefix, progress_dialog) {
929 filename_prefix = filename_prefix || "grid";
930 var localeStrings = this.localeStrings;
932 var mapkey_for_filename =
933 this.store.mapKey ? this.store.mapKey.substr(-8, 8) : "X";
935 var dispositionArgs = {
936 "defaultString": filename_prefix + "-" +
937 mapkey_for_filename + ".csv",
938 "defaultExtension": ".csv",
939 "filterName": localeStrings.CSV_FILTER_NAME,
940 "filterExtension": "*.csv",
944 var coal = this._columnOrderingAndLabels();
948 "columns": coal.columns,
949 "labels": coal.labels,
952 "flattenerOptions": {
953 "contentType": "text/csv",
956 "onComplete": function(text) {
958 progress_dialog.attr("title", "");
959 progress_dialog.hide();
960 openils.XUL.contentToFileSaveDialog(
961 text, localeStrings.CSV_SAVE_DIALOG, dispositionArgs
966 if (progress_dialog) {
967 progress_dialog.attr("title", localeStrings.FETCHING_CSV);
968 progress_dialog.show(true);
970 this.store.fetch(req);
973 /* Print the same data that the Flattener is feeding to the
974 * grid, sorted the same way too. Remove limit and offset (i.e.,
975 * print it all) unless those are passed in to the print() method.
977 "print": function(limit, offset, query_mixin) {
978 var coal = this._columnOrderingAndLabels();
980 "query": dojo.mixin({}, this.query, query_mixin),
982 "columns": coal.columns,
983 "labels": coal.labels
985 "flattenerOptions": {
986 "handleAs": "text", "contentType": "text/html"
988 "onComplete": function(text) {
989 openils.Util.printHtmlString(text);
995 req.start = offset || 0;
997 req.queryOptions.all = true;
1000 this.store.fetch(req);
1003 "printSelected": function() {
1005 id_blob[this.store.getIdentityAttributes()[0]] =
1006 this.getSelectedIDs();
1008 this.print(null, null, id_blob);
1011 "setBaseQuery": function(query) { /* sets a persistent query
1012 that always gets mixed in
1013 with whatever you do in the
1015 this._baseQuery = dojo.clone(this.query = query);
1020 /* monkey patch so we can get more attributes from each column in the
1021 * markup that specifies grid columns (table->thead->tr->[td,...])
1024 var b = dojox.grid.cells._Base;
1025 var orig_mf = b.markupFactory;
1027 b.markupFactory = function(node, cellDef) {
1028 orig_mf(node, cellDef);
1031 ["fpath", "ffilter"], function(a) {
1032 var value = dojo.attr(node, a);
1038 /* fsort and _visible are different. Assume true unless defined. */
1040 ["fsort", "_visible"], function(a) {
1041 var val = dojo.attr(node, a);
1042 cellDef[a] = (typeof val == "undefined" || val === null) ?
1043 true : dojo.fromJson(val);
1049 /* the secret to successfully subclassing dojox.grid.DataGrid */
1050 openils.widget.FlattenerGrid.markupFactory =
1051 dojox.grid.DataGrid.markupFactory;