-
Notifications
You must be signed in to change notification settings - Fork 0
/
jplist_test
300 lines (240 loc) · 8.12 KB
/
jplist_test
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!-- handlebars template -->
<script id="jplist-template" type="text/x-handlebars-template">
{{#each this}}
<div class="list-item box">
<div class="img left">
<img src="{{image}}" alt="" title=""/>
</div>
<div class="block right">
<p class="title">{{title}}</p>
<p class="desc">{{description}}</p>
<p class="like">{{likes}} Likes</p>
<p class="theme">{{keyword1}}, {{keyword2}}</p>
</div>
</div>
{{/each}}
</script>
<script>
$('document').ready(function () {
var $list = $('#demo .list')
,template = Handlebars.compile($('#jplist-template').html());
$('#demo').jplist({
itemsBox: '.list'
,itemPath: '.list-item'
,panelPath: '.jplist-panel'
//data source
,dataSource: {
type: 'server'
,server: {
//ajax settings
ajax: {
url: '/content/data-sources/php-mysql-demo/server-json.php'
,dataType: 'json'
,type: 'POST'
}
}
//render function for json + templates like handlebars, xml + xslt etc.
,render: function (dataItem, statuses) {
$list.html(template(dataItem.content));
}
}
});
});
</script>
Filter bills:
<!-- demo -->
<div id="demo">
<!-- panel -->
<div class="jplist-panel">
<!-- reset button -->
<button
type="button"
class="jplist-reset-btn"
data-control-type="reset"
data-control-name="reset"
data-control-action="reset">
Reset <i class="fa fa-share"></i>
</button>
<!-- items per page dropdown -->
<div
class="jplist-drop-down"
data-control-type="items-per-page-drop-down"
data-control-name="paging"
data-control-action="paging">
<ul>
<li><span data-number="3"> 3 per page </span></li>
<li><span data-number="5"> 5 per page </span></li>
<li><span data-number="10" data-default="true"> 10 per page </span></li>
<li><span data-number="all"> View All </span></li>
</ul>
</div>
<!-- sort dropdown -->
<div
class="jplist-drop-down"
data-control-type="sort-drop-down"
data-control-name="sort"
data-control-action="sort">
<ul>
<li><span data-path="default">Sort by</span></li>
<li><span data-path=".title" data-order="asc" data-type="text">Title A-Z</span></li>
<li><span data-path=".title" data-order="desc" data-type="text">Title Z-A</span></li>
<li><span data-path=".desc" data-order="asc" data-type="text">Description A-Z</span></li>
<li><span data-path=".desc" data-order="desc" data-type="text">Description Z-A</span></li>
<li><span data-path=".like" data-order="asc" data-type="number">Likes asc</span></li>
<li><span data-path=".like" data-order="desc" data-type="number">Likes desc</span></li>
</ul>
</div>
<!-- text filter by title -->
<div class="text-filter-box">
<!--[if lt IE 10]>
<div class="jplist-label">Filter by Title:</div>
<![endif]-->
<input
data-path=".title"
data-button="#title-search-button"
type="text"
value=""
placeholder="Filter by Title"
data-control-type="textbox"
data-control-name="title-filter"
data-control-action="filter"
/>
<button
type="button"
id="title-search-button">
<i class="fa fa-search"></i>
</button>
</div>
<!-- text filter by description -->
<div class="text-filter-box">
<!--[if lt IE 10]>
<div class="jplist-label">Filter by Description:</div>
<![endif]-->
<input
data-path=".desc"
data-button="#desc-search-button"
type="text"
value=""
placeholder="Filter by Description"
data-control-type="textbox"
data-control-name="desc-filter"
data-control-action="filter"
/>
<button
type="button"
id="desc-search-button">
<i class="fa fa-search"></i>
</button>
</div>
<!-- checkbox filters -->
<div
class="jplist-group"
data-control-type="checkbox-group-filter"
data-control-action="filter"
data-control-name="themes">
<input
data-path=".architecture"
id="architecture"
type="checkbox"
/>
<label for="architecture">Architecture</label>
<input
data-path=".christmas"
id="christmas"
type="checkbox"
/>
<label for="christmas">Christmas</label>
<input
data-path=".nature"
id="nature"
type="checkbox"
/>
<label for="nature">Nature</label>
<input
data-path=".lifestyle"
id="lifestyle"
type="checkbox"
/>
<label for="lifestyle">Lifestyle</label>
</div>
<div
class="jplist-group"
data-control-type="checkbox-group-filter"
data-control-action="filter"
data-control-name="colors">
<input
data-path=".red"
id="red-color"
type="checkbox"
/>
<label for="red-color">Red</label>
<input
data-path=".green"
id="green-color"
type="checkbox"
/>
<label for="green-color">Green</label>
<input
data-path=".blue"
id="blue-color"
type="checkbox"
/>
<label for="blue-color">Blue</label>
<input
data-path=".brown"
id="brown-color"
type="checkbox"
/>
<label for="brown-color">Brown</label>
</div>
<!-- list / grid view -->
<div
class="jplist-views"
data-control-type="views"
data-control-name="views"
data-control-action="views"
data-default="jplist-list-view">
<button type="button" class="jplist-view jplist-list-view" data-type="jplist-list-view"></button>
<button type="button" class="jplist-view jplist-grid-view" data-type="jplist-grid-view"></button>
</div>
<!-- pagination results -->
<div
class="jplist-label"
data-type="Page {current} of {pages}"
data-control-type="pagination-info"
data-control-name="paging"
data-control-action="paging">
</div>
<!-- pagination -->
<div
class="jplist-pagination"
data-control-type="pagination"
data-control-name="paging"
data-control-action="paging">
</div>
<!-- preloader for data sources -->
<div
class="jplist-hide-preloader jplist-preloader"
data-control-type="preloader"
data-control-name="preloader"
data-control-action="preloader">
<img src="/content/img/common/ajax-loader-line.gif" alt="Loading..." title="Loading..." />
</div>
</div>
<!-- HTML data -->
<div class="list">
<!-- item 1 -->
<div class="list-item">
...
</div>
<!-- item 2 -->
<div class="list-item">
...
</div>
...
</div>
<!-- no results found -->
<div class="jplist-no-results">
<p>No results found</p>
</div>
</div>