]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/dojo/openils/widget/FlattenerFilterPane.js
LP1615805 No inputs after submit in patron search (AngularJS)
[working/Evergreen.git] / Open-ILS / web / js / dojo / openils / widget / FlattenerFilterPane.js
1 if (!dojo._hasResource["openils.widget.FlattenerFilterPane"]) {
2     dojo._hasResource["openils.widget.FlattenerFilterPane"] = true;
3
4     dojo.provide("openils.widget.FlattenerFilterPane");
5     dojo.require("openils.widget.PCrudFilterPane");
6
7     dojo.declare(
8         "openils.widget.FlattenerFilterPane",
9         [openils.widget.PCrudFilterPane], {
10             "mapTerminii": null,
11
12             "constructor": function(args) {
13                 dojo.mixin(this, args);
14             },
15
16             "_buildFieldStore": function() {
17                 var self = this;
18
19                 if (!this.mapTerminii)
20                     throw new Error("No mapTerminii list; can't proceed");
21
22                 var realFieldList = dojo.clone(this.mapTerminii).filter(
23                     function(o) {
24                         if (self.suppressFilterFields &&
25                             dojo.indexOf(
26                                 self.suppressFilterFields, o.simple_name
27                             ) > -1
28                         ) {
29                             return false;
30                         }
31
32                         return o.isfilter;
33                     }
34                 );
35
36                 this.fieldStore = new dojo.data.ItemFileReadStore({
37                     "data": {
38                         "identifier": "simple_name",
39                         "name": "label",
40                         "items": realFieldList.map(
41                             function(item) {
42                                 return {
43                                     "label": item.label,
44                                     "name": item.name,
45                                     "type": item.datatype,
46                                     "fmClass": item.fmClass,
47                                     "simple_name": item.simple_name,
48                                     "indirect": item.indirect
49                                 };
50                             }
51                         )
52                     }
53                 });
54             }
55         }
56     );
57 }