forked from evoluteur/evolutility-ui-jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviews.html
More file actions
381 lines (273 loc) · 14.5 KB
/
Copy pathviews.html
File metadata and controls
381 lines (273 loc) · 14.5 KB
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="../dist/css/vendors.min.css" rel="stylesheet"/>
<link href="../dist/css/demo.css" rel="stylesheet"/>
<link href="../dist/css/evolutility.css" rel="stylesheet"/>
<title>Evolutility Views</title>
</head>
<body>
<div class="evo-header">
<div class="evo-logo"><a href="../index.html"><span>evol</span>utility<span>.js</span></a></div>
<ul class="evo-head-links">
<li><a href="../demo/index.html">demo</a></li>
<li><a href="../doc/index.html" class="sel">doc</a></li>
<li><a href="https://github.com/evoluteur/evolutility" target="_new">GitHub</a></li>
</ul>
<ul class="evo-head-links2">
<li><a href="views.html" class="sel">views</a></li>
<li><a href="ui-model.html">ui-model</a></li>
<li><a href="controller.html">controller</a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="evo-title2">
<h1>Views</h1>
<div class="list-views">
<div>
<a href="#one-view"><i class="glyphicon glyphicon-file"></i>View</a>
<a href="#one-edit"><i class="glyphicon glyphicon-th"></i>Edit</a>
<a href="#one-mini"><i class="glyphicon glyphicon-th-large"></i>Mini</a>
<a href="#one-json"><i class="glyphicon glyphicon-barcode"></i>JSON</a>
</div>
<div>
<a href="#many-list"><i class="glyphicon glyphicon-th-list"></i>List</a>
<a href="#many-badges"><i class="glyphicon glyphicon-th-large"></i>Badges</a>
<a href="#many-charts"><i class="glyphicon glyphicon-stats"></i>Charts</a>
</div>
<div>
<a href="#action-filter"><i class="glyphicon glyphicon-filter"></i>Filter</a>
<a href="#action-export"><i class="glyphicon glyphicon-cloud-download"></i>Export</a>
</div>
</div>
</div>
<div class="evo-content3">
<p>Evolutility provides a set of Backbone views
for manipulating (viewing, editing, filtering, exporting...) Backbone models and collections.
These views are not defined in templates and custom code
but configured by a <a href="ui-model.html">ui-model</a>.</p>
<p>Evolutility views are of 3 different types:
<ul class="evo-links-views">
<li>Views for <strong>one</strong> model: <a href="#one">Evol.ViewOne</a>
<br/>
<a href="#one-view"><i class="glyphicon glyphicon-file"></i>View</a>,
<a href="#one-edit"><i class="glyphicon glyphicon-th"></i>Edit</a>,
<a href="#one-mini"><i class="glyphicon glyphicon-th-large"></i>Mini</a> (quick-edit),
<a href="#one-json"><i class="glyphicon glyphicon-barcode"></i>JSON</a>...
</li>
<li>Views for a collection of <strong>many</strong> models: <a href="#many">Evol.ViewMany</a>
<br/>
<a href="#many-list"><i class="glyphicon glyphicon-th-list"></i>List</a>,
<a href="#many-badges"><i class="glyphicon glyphicon-th-large"></i>Badges</a>,
<a href="#many-charts"><i class="glyphicon glyphicon-stats"></i>Charts</a>...
</li>
<li>Views for <strong>actions</strong> on a collection or a model: <a href="#action">Evol.ViewAction</a>
<br/>
<a href="#action-filter"><i class="glyphicon glyphicon-filter"></i>Filter</a>,
<a href="#action-export"><i class="glyphicon glyphicon-cloud-download"></i>Export</a>...
</li>
</ul>
Views API: <a href="#methods">Methods</a>,
<a href="#options">Options</a>,
<a href="#events">Events</a>.
</p>
<p>A large part of the API (<a href="#methods">methods</a>, <a href="#options">options</a> and <a
href="#events">events</a>) is common to all views.
Some views have additional API.
</p>
<p>More Views will be added in the future (thinking of Summary, Import, Mass update, Group, Dashboard, Report, PDF,
Auto-documentation and specs...).
<div class="evol-doc-views">
<a name="one" class="evo-anchor"> </a>
<section id="views-one">
<h2>Evol.ViewOne</h2>
<p>Backbone views for <strong>one</strong> model.</p>
<p class="evo-links-views">
<a href="#one-view"><i class="glyphicon glyphicon-file"></i>View</a>,
<a href="#one-edit"><i class="glyphicon glyphicon-th"></i>Edit</a>,
<a href="#one-mini"><i class="glyphicon glyphicon-th-large"></i>Mini</a> (quick-edit),
<a href="#one-json"><i class="glyphicon glyphicon-barcode"></i>JSON</a>...
</p>
<a name="one-view" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-file"></i> View</h3>
<p>Shows all fields for viewing (read only). Fields are grouped in panels and tabs.</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/one-view.png"/> <br/>
</div>
<p><code>var vw = new Evol.ViewOne.View(myConfig);</code></p>
<div id="v-view"></div>
<a name="one-edit" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-th"></i> Edit</h3>
<p>This view shows all fields for edition to create or update models.
It automatically performs validation based on the UI-model and supports
the Master-Details pattern (nested collections).
Fields are grouped in panels and tabs.
</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/one-edit.png"/> <br/>
</div>
<p><code>
var vw = new Evol.ViewOne.Edit(myConfig);
</code></p>
<a name="one-mini" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-th-large"></i> Mini (quick-edit)</h3>
<p>Only shows important fields (required or showing as a column in grids). Fields are grouped in a single panel.</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/one-mini.png"/> <br/>
</div>
<p><code>
var vw = new Evol.ViewOne.Mini(myConfig);</code></p>
<a name="one-json" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-barcode"></i> JSON</h3>
<p>JSON representation of the data.</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/one-json.png"/> <br/>
</div>
<p><code>
var vw = new Evol.ViewOne.JSON(myConfig);</code></p>
<p>Other possible views: Wizard...</p>
</section>
<a name="many" class="evo-anchor"> </a>
<section id="views-many">
<h2>Evol.ViewMany</h2>
<p>Backbone views for a collection containing <strong>many</strong> models.</p>
<p class="evo-links-views">
<a href="#many-list"><i class="glyphicon glyphicon-th-list"></i>List</a>,
<a href="#many-badges"><i class="glyphicon glyphicon-th-large"></i>Badges</a>,
<a href="#many-charts"><i class="glyphicon glyphicon-stats"></i>Charts</a>...</li>
</p>
<a name="many-list" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-th-list"></i> List</h3>
<p>Gives a tabular view of a collection with paging.</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/many-list.png"/><br/>
</div>
<p><code>
var vw = new Evol.ViewMany.List(myConfig);</code></p>
<a name="many-badges" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-th-large"></i> Badges</h3>
<p>Shows records side by side as badges.</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/many-badges.png"/><br/>
</div>
<p><code>
var vw = new Evol.ViewMany.Badges(myConfig);</code></p>
<a name="many-charts" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-stats"></i> Charts</h3>
<p>Draws charts about the collection.</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/many-charts.png"/><br/>
</div>
<p><code>
var vw = new Evol.ViewMany.Charts(myConfig);</code></p>
</section>
<a name="action" class="evo-anchor"> </a>
<section id="views-action">
<h2>Evol.ViewAction</h2>
<p>Backbone Views for actions on a collection or a model.</p>
<p class="evo-links-views">
<a href="#action-filter"><i class="glyphicon glyphicon-filter"></i>Filter</a>,
<a href="#action-export"><i class="glyphicon glyphicon-cloud-download"></i>Export</a>...
</p>
<a name="action-filter" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-filter"></i> Filter</h3>
<p>View used to build a structured query to filter a collection.</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/action-filter.png"/><br/>
</div>
<p>Filter example: "phone number start by 415" or "for
categories Finances and Business"... </p>
<p><code>
var vw = new Evol.ViewAction.Filter(myConfig);</code></p>
<a name="action-export" class="evo-anchor"> </a>
<h3><i class="glyphicon glyphicon-cloud-download"></i> Export</h3>
<p>View to define export options and preview the collection export in different data formats (CSV, TAB, HTML, XML,
SQL and JSON).
</p>
<div class="evol-doc-views">
<img class="pixEvoMode shadow" src="screenshots/action-export.png"/><br/>
</div>
<p><code>
var vw = new Evol.ViewAction.Export(myConfig);</code></p>
</section>
<a name="methods" class="evo-anchor"> </a>
<section>
<h2>Methods</h2>
<p><br>Methods common to Evol.ViewOne (Edit, View, Mini, JSON) and Evol.ViewMany (List, Badges, Charts):</p>
<p><strong>render()</strong>: Renders the view in the DOM.</p>
<p><strong>getFields()</strong>: Returns an array of the UI-model fields present in the view.</p>
<p><strong>getModel(), setModel(model)</strong>: Gets or sets the Backbone model.</p>
<p><strong>getUIModel(), setUIModel(uiModel)</strong>: Gets or sets the UI model.</p>
<p><strong>getTitle(), setTitle(title)</strong>: Gets or sets the view title.</p>
<p><strong>setDefaults</strong>: Sets all fields to their default value.</p>
<p><br>Methods specific to Evol.ViewOne (Edit, View, Mini, JSON):</p>
<p><strong>clear()</strong>: Clears the content of all fields.</p>
<p><strong>clearErrors()</strong>: Remove previous validation warnings.</p>
<p><strong>getData(), setData(data)</strong>: Gets or sets all fields values at the same time (similar but different than getModel and setModel).</p>
<p><strong>getFieldValue(fid), setFieldValue(fid, value)</strong>: Gets or sets the value of a specific field.</p>
<p><strong>getFieldProp(fid, property), setFieldProp(fid, property, value)</strong>: Gets or sets a field property for a specific field. Supported properties: "value", "enabled", "visible".</p>
<p><strong>getSubCollecs()</strong>: Returns an array of sub-collections definitions from the UI-model.</p>
<p><strong>validate()</strong>: Validates all fields and shows warnings if necessary.</p>
<p><br>Methods specific to Evol.ViewMany (List, Badges, Charts):</p>
<p><strong>getCollection(), setCollection(collec)</strong>: Gets or sets the collection.</p>
<p><strong>getFilter(), setFilter(filter)</strong>: Gets or sets the collection filter (from Evol.ViewAction.Filter).</p>
<p><strong>getPage(), setPage(pageIndex)</strong>: Gets or sets the page index for pagination.</p>
<p><strong>sortList(field, upOrDown, [noRemember], [noTrigger])</strong>: Sorts the list by a specific field.</p>
<p><strong>getSelection(), setSelection([fieldId])</strong>: Gets or sets rows selection.</p>
<p><br>Methods specific to Evol.ViewAction.Filter:</p>
<p><strong>val</strong>: Returns the filter value.</p>
<p><strong>valText</strong>: Default value = false.</p>
<p><strong>clear</strong>: Default value = false.</p>
<p><strong>addCondition(condition), removeCondition(index)</strong>: Default value = false.</p>
<p><br>Methods specific to Evol.ViewAction.Export:</p>
<p><strong>val</strong>: Returns the selected export settings.</p>
</section>
<a name="options" class="evo-anchor"> </a>
<section>
<h2>Options</h2>
<p><br>Options common to Evol.ViewOne (Edit, View, Mini, JSON) and Evol.ViewMany (List, Badges, Charts):</p>
<p><strong>iconsPath</strong>: Path to icons for model and list of values.</p>
<p><br>Options specific to Evol.ViewOne (Edit, View, Mini, JSON):</p>
<p><strong>button_addAnother</strong>: Show a "Save and Add Another" button next to "Save". Default value = false.</p>
<p><br>Options specific to Evol.ViewMany.List and Evol.ViewMany.Badges:</p>
<p><strong>pageSize</strong>: Maximum number of models per page. Default value = 20.</p>
<p><strong>pageIndex</strong>: Index of the current page. Default value = 0.</p>
<p><strong>selectable</strong>: Specify if a checkbox will be displayed for each model. Default value = false.</p>
</section>
<a name="events" class="evo-anchor"> </a>
<section>
<h2>Events</h2>
<p>Events for Evol.ViewOne (Edit, View, Mini, JSON):</p>
<div id="evt-one">
<p><strong>action</strong>: Triggered when buttons are clicked. data = 'add', 'add-new', 'cancel', 'validate'.</p>
<p><strong>toggle.panel</strong>: Triggered when a panel is expended or collapsed.</p>
<p><strong>change.tab</strong>: Triggered when the active tab changes.</p>
</div>
<p><br>Events for Evol.ViewMany.List and Evol.ViewMany.Badges:</p>
<div id="evt-many">
<p><strong>selection.many</strong>: Triggered when the selection changes.</p>
<p><strong>navigate.many</strong>: Triggered when a link to a model is clicked.</p>
<p><strong>sort.many</strong>: Triggered on sort.</p>
<p><strong>paginate.many</strong>: Triggered on pagination.</p>
</div>
<p><br>Events for Evol.ViewAction.Filter:</p>
<div id="evt-filter">
<p><strong>change.filter</strong>: Triggered when a filter condition changes.</p>
<p><strong>submit.filter</strong>: Triggered on submit (if options allow the submit button).</p>
</div>
<p><br>Events for Evol.ViewAction.Export:</p>
<div id="evt-export">
<p><strong>action</strong>: Triggered when the "Download" button is clicked. data = format.</p>
<p><strong>change.export</strong>: Triggered when any export setting changes.</p>
</div>
</section>
</div>
<p></p>
<p><br/>evolutility.js at <a href="https://github.com/evoluteur/evolutility" target="download">GitHub</a></p>
</div>
<div class="footer">© 2015 Olivier Giulieri</div>
</body>
</html>