forked from squidsolutions/jssdk-filters-widget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
152 lines (143 loc) · 5.15 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Squid JSSDK test App</title>
<link type="text/css" rel="stylesheet" href="bower_components/jquery-ui/themes/ui-lightness/jquery-ui.min.css">
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/underscore/underscore.js"></script>
<script src="bower_components/backbone/backbone.js"></script>
<script src="bower_components/squid_api/dist/squid_api.js"></script>
<script src="bower_components/handlebars/handlebars.js"></script>
<script src="bower_components/jquery-ui/ui/jquery-ui.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/bootstrap-multiselect/js/bootstrap-multiselect.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="bower_components/d3/d3.js"></script>
<!-- endbower -->
<script src="dist/squid_api_filter-widget.js"></script>
</head>
<body>
<div class="container" id="main">
<span class="small" id="status"></span>
<div id="login"></div>
<h2>A filter view with all dimensions</h2>
<div id="filters"></div>
<h2>A filter view with only categorical dimensions</h2>
<div id="categories"></div>
<h2>A filter view with only date dimension</h2>
<div id="date-picker"></div>
</div>
<script>
var projectId = "p1";
var domainId = "d1";
var defaultSelection = {
"facets" : [ {
"items" : [{
"type" : "i",
"lowerBound" : "2014-04-01T00:00:00.000Z",
"upperBound" : "2014-05-30T00:00:00.000Z"
} ],
"selectedItems" : [ {
"type" : "i",
"lowerBound" : "2014-04-15T00:00:00.000Z",
"upperBound" : "2014-04-30T00:00:00.000Z"
} ],
"dimension" : {
"id" : {
"projectId" : "els_flow_1",
"domainId" : "usage",
"dimensionId" : "session_cre_dt"
},
"accessRights" : [],
"type" : "CONTINUOUS",
"expression" : null,
"parentId" : null,
"attributes" : [],
"oid" : "session_cre_dt",
"objectType" : "Dimension",
"name" : "Creation Date"
},
"id" : "usage:session_cre_dt",
"totalSize" : 0
}, {
"items" : [{
"type" : "v",
"id" : 1,
"value" : "Customer1"
},{
"type" : "v",
"id" : 2,
"value" : "Customer2"
},{
"type" : "v",
"id" : 3,
"value" : "Customer3"
}],
"selectedItems" : [ {
"type" : "v",
"id" : 3,
"value" : "Customer"
} ],
"dimension" : {
"id" : {
"projectId" : "els_flow_1",
"domainId" : "usage",
"dimensionId" : "usergroup"
},
"accessRights" : [],
"type" : "CATEGORICAL",
"expression" : null,
"parentId" : null,
"attributes" : [],
"oid" : "usergroup",
"objectType" : "Dimension",
"name" : "User Group"
},
"id" : "usage:usergroup",
"totalSize" : 0
} ]
};
</script>
<script>
$( document ).ready(function() {
var v0, v1, v2;
var filters = new squid_api.controller.facetjob.FiltersModel();
// A filter view with all dimensions
var v0 = new squid_api.view.FiltersView( {
model : filters,
el : '#filters',
refreshOnChange : false
});
// A filter view with only categorical dimensions
var v1 = new squid_api.view.FiltersView( {
model : filters,
el : '#categories',
refreshOnChange : false,
displayContinuous : false
});
// A filter view with only date dimension
var v2 = new squid_api.view.FiltersView( {
model : filters,
el : '#date-picker',
pickerVisible : true,
refreshOnChange : false,
displayCategorical : false
});
/*
* Start the App
*/
config = {
"customerId" : null,
"clientId" : null,
"projectId" : null,
};
squid_api.init(config);
filters.set("selection" , defaultSelection);
});
</script>
</body>
</html>