Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 520 lines (374 sloc) 16.693 kB
0b99b8c @javve Updated read me
authored
1 # List.js
c94316b @javve Changed file size from 9KB to 3KB (gzipped)
authored
2 Do you want a 3 KB (gzipped&minified) cross-browser native JavaScript that makes your plain HTML lists super flexible, searchable, sortable and filterable? **Yeah!**
1bd4ce6 @javve Better description and link to more examples
authored
3 Do you also want the possibility to add, edit and remove items by dead simple templating? **Hell yeah!**
0b99b8c @javve Updated read me
authored
4
5a5f2db @javve Updated readme
authored
5 # Super simple examples
2f0dc5f @javve First readme ever. Will probably not work
authored
6
1bd4ce6 @javve Better description and link to more examples
authored
7 More examples are found at [Listjs.com](http://listjs.com) and
8 [Listjs.com/examples.html](http://listjs.com/examples.html)
9
7967e64 @javve Readme fix
authored
10 ## Index existing list
11 HTML
12
e86b7ab @javve Added code examples and some more explanations
authored
13 <div id="hacker-list">
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
14 <ul class="list">
e86b7ab @javve Added code examples and some more explanations
authored
15 <li>
16 <h3 class="name">Jonny</h3>
17 <p class="city">Stockholm</p>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
18 </li>
e86b7ab @javve Added code examples and some more explanations
authored
19 <li>
20 <h3 class="name">Jonas</h3>
21 <p class="city">Berlin</p>
22 </li>
23 </ul>
24 </div>
25
7967e64 @javve Readme fix
authored
26 Javascript
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
27
5dfd1bf @javve Updated documentation
authored
28 var options = {
e86b7ab @javve Added code examples and some more explanations
authored
29 valueNames: [ 'name', 'city' ]
30 };
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
31
5dfd1bf @javve Updated documentation
authored
32 var hackerList = new List('hacker-list', options);
e86b7ab @javve Added code examples and some more explanations
authored
33
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
34 ## Create list on initialization
721c288 @javve Updated readme/documentation
authored
35
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
36 ### Version 1 (does not work with tables)
721c288 @javve Updated readme/documentation
authored
37 HTML
38
39 <div id="hacker-list">
40 <ul class="list"></ul>
41 </div>
42
43 JavaScript
44
45 var options = {
46 item: '<li><h3 class="name"></h3><p class="city"></p></li>'
47 };
48
49 var values = [
50 { name: 'Jonny', city:'Stockholm' }
51 , { name: 'Jonas', city:'Berlin' }
52 ];
53
54 var hackerList = new List('hacker-list', options, values);
55
56
57 ### Version 2
7967e64 @javve Readme fix
authored
58 HTML
59
e86b7ab @javve Added code examples and some more explanations
authored
60 <div id="hacker-list">
61 <ul class="list"></ul>
62 </div>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
63
64 <div style="display:none;">
e86b7ab @javve Added code examples and some more explanations
authored
65 <!-- A template element is needed when list is empty, TODO: needs a better solution -->
66 <li id="hacker-item">
67 <h3 class="name"></h3>
68 <p class="city"></p>
69 </li>
70 </div>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
71
7967e64 @javve Readme fix
authored
72 JavaScript
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
73
5dfd1bf @javve Updated documentation
authored
74 var options = {
e86b7ab @javve Added code examples and some more explanations
authored
75 item: 'hacker-item'
76 };
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
77
e86b7ab @javve Added code examples and some more explanations
authored
78 var values = [
79 { name: 'Jonny', city:'Stockholm' }
80 , { name: 'Jonas', city:'Berlin' }
81 ];
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
82
5dfd1bf @javve Updated documentation
authored
83 var hackerList = new List('hacker-list', options, values);
e86b7ab @javve Added code examples and some more explanations
authored
84
85
721c288 @javve Updated readme/documentation
authored
86
7967e64 @javve Readme fix
authored
87 ## Index existing list and then add
88 HTML
89
e86b7ab @javve Added code examples and some more explanations
authored
90 <div id="hacker-list">
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
91 <ul class="list">
e86b7ab @javve Added code examples and some more explanations
authored
92 <li>
93 <h3 class="name">Jonny</h3>
94 <p class="city">Stockholm</p>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
95 </li>
e86b7ab @javve Added code examples and some more explanations
authored
96 </ul>
97 </div>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
98
7967e64 @javve Readme fix
authored
99 JavaScript
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
100
5dfd1bf @javve Updated documentation
authored
101 var options = {
e86b7ab @javve Added code examples and some more explanations
authored
102 valueNames: ['name', 'city']
103 };
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
104
5dfd1bf @javve Updated documentation
authored
105 var hackerList = new List('hacker-list', options);
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
106
e86b7ab @javve Added code examples and some more explanations
authored
107 hackerList.add( { name: 'Jonas', city:'Berlin' } );
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
108
7967e64 @javve Readme fix
authored
109 ## Add automagic search and sort inputs and buttons
110 HTML
111
e86b7ab @javve Added code examples and some more explanations
authored
112 <div id="hacker-list">
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
113
e86b7ab @javve Added code examples and some more explanations
authored
114 <input class="search" />
b2da422 @javve Forgot to change the start page example, and updated readme examples too
authored
115 <span class="sort" data-sort="name">Sort by name</span>
116 <span class="sort" data-sort="city">Sort by city</span>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
117
118 <ul class="list">
e86b7ab @javve Added code examples and some more explanations
authored
119 <li>
120 <h3 class="name">Jonny</h3>
121 <p class="city">Stockholm</p>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
122 </li>
e86b7ab @javve Added code examples and some more explanations
authored
123 <li>
124 <h3 class="name">Jonas</h3>
125 <p class="city">Berlin</p>
126 </li>
127 </ul>
128 </div>
129
7967e64 @javve Readme fix
authored
130 Javascript (nothing special)
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
131
5dfd1bf @javve Updated documentation
authored
132 var options = {
e86b7ab @javve Added code examples and some more explanations
authored
133 valueNames: [ 'name', 'city' ]
134 };
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
135
5dfd1bf @javve Updated documentation
authored
136 var hackerList = new List('hacker-list', options);
e86b7ab @javve Added code examples and some more explanations
authored
137
138
721c288 @javve Updated readme/documentation
authored
139 # Plugins
140
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
141 List.js offers the possiblity to use and add plugins that are integrated in the list objects
914ab38 @francescolaffi Update README.md
francescolaffi authored
142 and are initiated at the same time as the lists. [Read more here »](http://jonnystromberg.com/listjs-plugins-guide/)
721c288 @javve Updated readme/documentation
authored
143
144 ## List of plugins
145
1a71680 @javve Removed the .dev from the paging url
authored
146 * **[Paging plugin](http://jonnystromberg.com/listjs-paging-plugin/)** - A plugin for easily adding
721c288 @javve Updated readme/documentation
authored
147 paging to List.js
68b425b @javve Added fuzzy search to plugin list
authored
148 * **[Fuzzy search plugin](http://jonnystromberg.com/listjs-fuzzy-search-plugin/)** - A plugin for fuzzy search matching
721c288 @javve Updated readme/documentation
authored
149
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
150 As you can see, there are currently only two plugins. But I would very much like to add your plugin
151 to this list if you just email me.
721c288 @javve Updated readme/documentation
authored
152
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
153 # Documentation
449e867 @javve Moved the examples first and updated changelog
authored
154
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
155 ## Search, sort and list container element
156 The secret behind the search field, the sort buttons, and the list container element are the classes.
157 By default, all inputs with class `search` become search fields for the list.
5dfd1bf @javve Updated documentation
authored
158
159 <input type="text" class="search" />
160
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
161 The sorting gets activated for all elements with class `sort` and then sorts the
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
162 `valueName` corresponding to the the `data-sort` value of the element.
5dfd1bf @javve Updated documentation
authored
163
b2da422 @javve Forgot to change the start page example, and updated readme examples too
authored
164 <span class="sort" data-sort="name">Sort names</span>
5dfd1bf @javve Updated documentation
authored
165
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
166 The element containing the list has to have the class `list` (or one that _you_ define)
5dfd1bf @javve Updated documentation
authored
167
168 <ul class="list"></ul>
169 # Can be a div, table, dl, or whatever fits your purpose
170
171 All of these classes can be defined by yourself when creating the list by setting the options
172 `searchClass`, `listClass` and `sortClass`.
173
449e867 @javve Moved the examples first and updated changelog
authored
174 ## Create a list
175
176 ### Constructor
177 * List(id, options, values)
178
179 ### Parameters
ec2a490 @javve Added possibility to initiate list with element instead of id
authored
180 * **id** or **element** *(\*required)*
181 Id the element in which the list area should be initialized. OR the actual element itself.
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
182 * **options**
449e867 @javve Moved the examples first and updated changelog
authored
183 Some of the option parameters are required at some times
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
184 * **valueNames** _(Array, default: null) (*only required if the list already contains items before initialization)_
185 If the list contains items on initialization, then this array
186 has to contain the value names (class names) for the different values of
5dfd1bf @javve Updated documentation
authored
187 each list item.
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
188
5dfd1bf @javve Updated documentation
authored
189 <ul class="list">
190 <li>
191 <span class="name">Jonny</span>
192 <span class="city">Sundsvall</span>
193 </li>
194 </ul>
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
195
5dfd1bf @javve Updated documentation
authored
196 var valueNames = ['name', 'city'];
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
197
721c288 @javve Updated readme/documentation
authored
198 * **item** _(String, default: undefined)_
199 ID to item template element or a string of HTML (**notice**: does not work with `<tr>`)
200
201 var options = {
202 item: "<li><span class='name'></span><span class='city'></span></li>"
203 }
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
204
721c288 @javve Updated readme/documentation
authored
205 * **listClass** _(String, default: "list")_
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
206 What is the class of the list-container?
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
207
721c288 @javve Updated readme/documentation
authored
208 * **searchClass** _(String, default: "search")_
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
209 What is the class of the search field?
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
210
721c288 @javve Updated readme/documentation
authored
211 * **sortClass** _(String, default: "sort")_
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
212 What is the class of the sort buttons?
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
213
721c288 @javve Updated readme/documentation
authored
214 * **indexAsync** _(Boolean, default: false)_
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
215 If there are already items in the list to which the
216 List.js-script is added, then should the indexing be done
449e867 @javve Moved the examples first and updated changelog
authored
217 in a asynchronous way? Good for large lists (> 500 items).
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
218
721c288 @javve Updated readme/documentation
authored
219 * **page** _(Int, default: 200)_ (maxVisibleItemsCount previously)
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
220 Defines how many items that should be visible at the same time. This affects
489c158 @javve Added possibility to change maxVisibleItemsCount
authored
221 performance.
721c288 @javve Updated readme/documentation
authored
222
223 * **i** _(Int, default: 1)_
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
224 Which item should be shown as the first one.
721c288 @javve Updated readme/documentation
authored
225
226 * **plugins** _(Array, default: undefined)_
227 [Read more about plugins here](http://jonnystromberg.com/listjs-plugins-guide/)
228
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
229 * **values** _(Array of objects) (*optional)_
449e867 @javve Moved the examples first and updated changelog
authored
230 Values to add to the list on initialization.
231
5a5f2db @javve Updated readme
authored
232
721c288 @javve Updated readme/documentation
authored
233 # List API
5a5f2db @javve Updated readme
authored
234 These methods are available for the List-object.
235
721c288 @javve Updated readme/documentation
authored
236 ### Properties
237 * **listContainer** _(Element)_
5a5f2db @javve Updated readme
authored
238 The element node that contains the entire list area.
721c288 @javve Updated readme/documentation
authored
239
240 * **list** _(Element)_
241 The element containing all items.
242
243 * **items** _(Array)_
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
244 An Array of all Item-objects in the list.
721c288 @javve Updated readme/documentation
authored
245
246 * **visibleItems** _(Array)_
247 The currently visible items in the list
248
249 * **matchingItems** _(Array)_
250 The items matching the currently active filter and search.
251
252 * **searched** _(Boolean)_
253 Returns true if the list is searched.
254
255 * **filtered** _(Boolean)_
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
256 Returns true if there is an active filter.
721c288 @javve Updated readme/documentation
authored
257
258 * **list** _(Element)_
5a5f2db @javve Updated readme
authored
259 The element containing all items.
721c288 @javve Updated readme/documentation
authored
260
261 * **templateEngines** _(Object)_
5a5f2db @javve Updated readme
authored
262 Contains all template engines available.
263
721c288 @javve Updated readme/documentation
authored
264 * **plugins** _(Object)_
265 The currently avaliable plugins.
266
267 ### Methods
268 * **add(values, callback)**
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
269 Adds one or more items to the list.
270
5dfd1bf @javve Updated documentation
authored
271 listObj.add({ name: "Jonny", city: "Stockholm" });
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
272
5dfd1bf @javve Updated documentation
authored
273 listObj.add([
274 { name: "Gustaf", city: "Sundsvall" }
275 , { name: "Jonas", city: "Berlin" }
276 ]);
277
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
278 If `callback` is set then items are added to the list in a asynchronous way, and the
279 callback is called when all items are added. This is especially useful
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
280 when adding very many items (200+ or something), or if you just like the
281 asynchronous coding style.
282
283 listObj.add(arrayWithManyManyItems, function(items) {
284 console.log('All ' + items.length + ' were added!');
285 });
5dfd1bf @javve Updated documentation
authored
286
721c288 @javve Updated readme/documentation
authored
287 * **remove(valueName, value)**
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
288 Removes items from the list where the value named `valueName` has value `value`.
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
289 Returns the number of items that where removed.
ba2d625 @javve Updated readme
authored
290
f5233ec @javve Updated read me
authored
291 itemsInList = [
292 { id: 1, name: "Jonny" }
293 , { id: 2, name "Gustaf" }
721c288 @javve Updated readme/documentation
authored
294 ];
f5233ec @javve Updated read me
authored
295 listObj.remove("id", 1); -> return 1
5a5f2db @javve Updated readme
authored
296
721c288 @javve Updated readme/documentation
authored
297 * **get(valueName, value)**
5dfd1bf @javve Updated documentation
authored
298 Returns values from the list where the value named `valueName` has value `value`.
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
299
f5233ec @javve Updated read me
authored
300 itemsInList = [
301 { id: 1, name: "Jonny" }
302 , { id: 2, name "Gustaf" }
721c288 @javve Updated readme/documentation
authored
303 ];
f5233ec @javve Updated read me
authored
304 listObj.get("id", 2); -> return { id: 2, name "Gustaf" }
5a5f2db @javve Updated readme
authored
305
721c288 @javve Updated readme/documentation
authored
306 * **sort(valueName, options)**
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
307 Sorts the list based on values the in the column named `valueName`. The options
721c288 @javve Updated readme/documentation
authored
308 parameter can contain two properties `options.sortFunction` and `options.asc`.
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
309 `options.sortFunction` is used if you want to make your own sort function.
310 The default sort function is found here [http://my.opera.com/GreyWyvern/blog/show.dml/1671288](http://my.opera.com/GreyWyvern/blog/show.dml/1671288)
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
311 `options.asc = true` means that you want to sort the list in ascending order. Set
ffa2370 @javve New release 0.1.3 -> Updated the change log and documentation
authored
312 `false` for descending.
5dfd1bf @javve Updated documentation
authored
313
ffa2370 @javve New release 0.1.3 -> Updated the change log and documentation
authored
314 listObj.sort('name', { asc: true }); -> Sorts the list in abc-order based on names
315 listObj.sort('name', { asc: false }); -> Sorts the list in zxy-order based on names
5a5f2db @javve Updated readme
authored
316
721c288 @javve Updated readme/documentation
authored
317 * **search(searchString, columns)**
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
318 Searches the list
5a5f2db @javve Updated readme
authored
319
84aa688 @javve Updated readme with release notes and updated version number
authored
320 itemsInList = [
321 { id: 1, name: "Jonny" }
322 , { id: 2, name "Gustaf" }
323 , { id: 3, name "Jonas" }
721c288 @javve Updated readme/documentation
authored
324 ];
84aa688 @javve Updated readme with release notes and updated version number
authored
325
326 listObj.search('Jonny'); -> Only item with name Jonny is shown (also returns this item)
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
327
84aa688 @javve Updated readme with release notes and updated version number
authored
328 listObj.search(); -> Show all items in list
329
721c288 @javve Updated readme/documentation
authored
330 * **clear()**
cb8bc2d @javve Added .clear() to the list, removes all items from the list
authored
331 Removes all items from the list
332
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
333 * **filter(filterFunction)**
5dfd1bf @javve Updated documentation
authored
334
335 itemsInList = [
336 { id: 1, name: "Jonny" }
337 , { id: 2, name "Gustaf" }
338 , { id: 3, name "Jonas" }
721c288 @javve Updated readme/documentation
authored
339 ];
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
340
99fd99c @sprynmr Updated readme
sprynmr authored
341 listObj.filter(function(item) {
342 if (item.values().id > 1) {
5dfd1bf @javve Updated documentation
authored
343 return true;
344 } else {
345 return false;
346 }
347 }); -> Only items with id > 1 are shown in list
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
348
84aa688 @javve Updated readme with release notes and updated version number
authored
349 listObjs.filter(); -> Remove all filters
5dfd1bf @javve Updated documentation
authored
350
721c288 @javve Updated readme/documentation
authored
351 * **size()**
352 Returns the size of the list.
5a5f2db @javve Updated readme
authored
353
721c288 @javve Updated readme/documentation
authored
354 * **show(i, page)**
355 Shows `page` number of items from `i`. Use for paging etc.
5a5f2db @javve Updated readme
authored
356
721c288 @javve Updated readme/documentation
authored
357 itemsInList = [
358 { id: 1, name: "Jonny" }
359 , { id: 2, name "Gustaf" }
360 , { id: 3, name "Jonas" }
361 , { id: 4, name "Egon" }
362 , { id: 5, name "Frank" }
363 , { id: &, name "Ester" }
364 ];
365
366 listObj.show(4, 3); -> Display item 4,5,6
367
368
369 * **update()**
370 Updates the current state of the list. Meaning that if you for instance
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
371 hides some items with the `itemObj.hide()` method then you have to call `listObj.update()`
721c288 @javve Updated readme/documentation
authored
372 if you want the paging to update.
373
374 * **on(event, callback)**
375 Execute `callback` when list have been updated (triggered by `update()`, which is used by a lot of methods).
376
377 # Item API
5a5f2db @javve Updated readme
authored
378 These methods are available for all Items that are returned by
379 the list.
721c288 @javve Updated readme/documentation
authored
380
381 ### Properties
5845608 @javve Updated documentation for item.values()
authored
382
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
383 * **elm** _(Element)_
5845608 @javve Updated documentation for item.values()
authored
384 The actual item DOM element
385
721c288 @javve Updated readme/documentation
authored
386 ### Methods
f5233ec @javve Updated read me
authored
387 * **values(newValues)**
5845608 @javve Updated documentation for item.values()
authored
388 * newValues _optional_
389 If variable newValues are present the new values replaces the current item values
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
390 and updates the list.
5845608 @javve Updated documentation for item.values()
authored
391 If newValues are not present, the function returns the current values.
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
392
5dfd1bf @javve Updated documentation
authored
393 item.values() -> { name: "Jonny", age: 24, city: "Umeå" }
5845608 @javve Updated documentation for item.values()
authored
394 item.values({
5dfd1bf @javve Updated documentation
authored
395 age: 25,
396 city: "Stockholm"
5845608 @javve Updated documentation for item.values()
authored
397 });
5dfd1bf @javve Updated documentation
authored
398 item.values() -> { name: "Jonny", age: 25, city: "Stockholm" }
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
399
721c288 @javve Updated readme/documentation
authored
400 * **show()**
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
401 Shows the item
f5233ec @javve Updated read me
authored
402
721c288 @javve Updated readme/documentation
authored
403 * **hide()**
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
404 Hides the item (removes the element from the list, and then when its shown it's appended again. The element will thereby change position in the list. A bug, but a good solution is yet to be found.)
f5233ec @javve Updated read me
authored
405
721c288 @javve Updated readme/documentation
authored
406 * **matching()**
7faa4d8 @imevul Fixed grammar and spelling errors in the readme.
imevul authored
407 Returns boolean. True if the item matches the current filter and search. Visible items
721c288 @javve Updated readme/documentation
authored
408 always matches, but matching items are not always visible.
f5233ec @javve Updated read me
authored
409
721c288 @javve Updated readme/documentation
authored
410 * **visisble()**
411 Returns boolean. True if the item is visible. Visible items
412 always matches, but matching items are not always visible.
0607541 @javve Added links to helper function source and more info about template en…
authored
413
f5233ec @javve Updated read me
authored
414
5a5f2db @javve Updated readme
authored
415
416 ## Helper functions
417 Called by ListJsHelpers.functionName()
418
721c288 @javve Updated readme/documentation
authored
419 * **getByClass(element, class, isSingle)**
0607541 @javve Added links to helper function source and more info about template en…
authored
420 [http://www.dustindiaz.com/getelementsbyclass](http://www.dustindiaz.com/getelementsbyclass)
421
721c288 @javve Updated readme/documentation
authored
422 * **addEvent(element, type, callback)**
0607541 @javve Added links to helper function source and more info about template en…
authored
423 [http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/](http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/)
424 Updated in some ways, thought.
f5233ec @javve Updated read me
authored
425
721c288 @javve Updated readme/documentation
authored
426 * **getAttribute(element, attribute)**
0607541 @javve Added links to helper function source and more info about template en…
authored
427 [http://stackoverflow.com/questions/3755227/cross-browser-javascript-getattribute-method](http://stackoverflow.com/questions/3755227/cross-browser-javascript-getattribute-method)
f5233ec @javve Updated read me
authored
428
721c288 @javve Updated readme/documentation
authored
429 * **isNodeList(element)**
0607541 @javve Added links to helper function source and more info about template en…
authored
430 [http://stackoverflow.com/questions/7238177/detect-htmlcollection-nodelist-in-javascript](http://stackoverflow.com/questions/7238177/detect-htmlcollection-nodelist-in-javascript)
f5233ec @javve Updated read me
authored
431
721c288 @javve Updated readme/documentation
authored
432 * **hasClass(element, class)**
8329f61 @javve Updated readme
authored
433 Checks if `element` has class name `class`
434
721c288 @javve Updated readme/documentation
authored
435 * **addClass(element, class)**
8329f61 @javve Updated readme
authored
436 Adds class name `class` to `element`
437
721c288 @javve Updated readme/documentation
authored
438 * **removeClass(element, class)**
8329f61 @javve Updated readme
authored
439 Removes class name `class` from `element`
440
441
721c288 @javve Updated readme/documentation
authored
442 # Plugins (paging)
443 Read more about plugins in [this blog post](http://jonnystromberg.com/listjs-plugins-guide/) and find out [how to use the paging plugin here](http://jonnystromberg.com/listjs-paging-plugin/).
444
8329f61 @javve Updated readme
authored
445
dd64e55 @javve Added performance section to readme and fix'd typo
authored
446 # Performance and benchmarking
447 Read about it at [The List.js Blog: Performance, wroooooom! Index, search and sort thousands of items](http://blog.listjs.com/post/12006163208/performance-wroooooom-index-search-and-sort)
448 and try it at the [performance test page](http://listjs.com/examples/performance-test.html).
449
450
451 # How to build the script
5205fc0 @javve Added build scrips and put minified files in root
authored
452 Type just *ant* in the console while in root folder.
453
5a5f2db @javve Updated readme
authored
454 # Changelog
ffa2370 @javve New release 0.1.3 -> Updated the change log and documentation
authored
455
cc958dd @javve Added release notes
authored
456 ### 2012-04-24 Beta 0.2.1
457 * Fuzzy Search plugin, `.filter()` changes and bug fixes **[Read more »](http://jonnystromberg.com/listjs-0-2-1-release-notes/)**
458
e9ad939 @javve Updated version number
authored
459 ### 2012-01-23 Beta 0.2.0
460 * Lots of updates and interesting features. **[Read more »](http://jonnystromberg.com/listjs-0-2-0-plugins-paging/)**
721c288 @javve Updated readme/documentation
authored
461
3fdb5c1 @javve Added date to last entry in the changelog
authored
462 ### 2011-12-15 Beta 0.1.4
84aa688 @javve Updated readme with release notes and updated version number
authored
463 * `.filters()`, `.sort()` and `.search()` now deped on each other. If the list is filtered and then
464 there is a search, the items hidden by the filters will stay hidden etc.
465 * `.filter()` is the only way to reset filter. `.filter(false)` does not work anymore.
466
ffa2370 @javve New release 0.1.3 -> Updated the change log and documentation
authored
467 ### 2011-11-29 Beta 0.1.3 release
468 * Added function `.clear()` that removes all items from the list
469 * Changed the sort function to be based on `data-sort` instead of `rel`
470 * When sorting one category, all sort-related classes will be removed from the other sort buttons
471 * Updated `.sort(valueName, sortFunction)` to `.sort(valueName, options)`, se more info in the documentation
472
8329f61 @javve Updated readme
authored
473 ### 2011-11-16 Beta 0.1.2 release
474 * Sorting is now indicated by class `asc` or `desc` at sorting buttons
475 * Added three new small helper functions `hasClass(element, class)`, `addClass(element, class)`
476 and `removeClass(element, class)`
477
405149b @javve Updated changelog
authored
478 ### 2011-10-20 Beta 0.1.1 release
479 * Added possibility to reverse sort the list
480
5845608 @javve Updated documentation for item.values()
authored
481 ### 2011-10-18 Beta 0.1 release
482 * Examples at Listjs.com works in IE7,8,9 (IE6 is not tested, should work)
483 * More documentation
484 * Misc bug fixes
485
449e867 @javve Moved the examples first and updated changelog
authored
486 ### 2011-10-15 Final alpha 0.3 release
487 * More documentation
488 * Only show 200 items at same time, huge speed increase
489 * Misc bug fixes
490
f5233ec @javve Updated read me
authored
491 ### 2011-08-08 Alpha 0.2 release
b569767 @javve Alpha 0.2 release notices
authored
492 * Added asynchronous item adding
493 * Added asynchronous list indexing
494 * Improved (but incomplete) documentation
495 * Bugfixes and improved helper functions
496 * Show helper functions non-minified
f5233ec @javve Updated read me
authored
497
381c895 @javve Added license information.
authored
498 ### 2011-07-25 Alpha 0.1 release
499
500 # License (MIT)
501
721c288 @javve Updated readme/documentation
authored
502 Copyright (c) 2012 Jonny Strömberg http://jonnystromberg.com
381c895 @javve Added license information.
authored
503
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
504 Permission is hereby granted, free of charge, to any person obtaining
505 a copy of this software and associated documentation files (the "Software"),
506 to deal in the Software without restriction, including without limitation the
507 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
508 sell copies of the Software, and to permit persons to whom the Software is
dd64e55 @javve Added performance section to readme and fix'd typo
authored
509 furnished to do so, subject to the following conditions:
510
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
511 The above copyright notice and this permission notice shall be included in
dd64e55 @javve Added performance section to readme and fix'd typo
authored
512 all copies or substantial portions of the Software.
513
87e6cff @javve Added callback to .add() and removed .addAsync() (async is automatic …
authored
514 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
515 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
516 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
517 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
518 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
519 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dd64e55 @javve Added performance section to readme and fix'd typo
authored
520 DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.