Skip to content

Commit ef8d16c

Browse files
author
Jiren Patel
committed
Update documentation
- Template should have parent tag - json record must have id field - Where filter element going to append html must be blank.
1 parent 03af4bb commit ef8d16c

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ each other.
99
Usage
1010
-----
1111

12-
Capture the JSON data (maybe using @people.to_json)
12+
Capture the JSON data (maybe using @people.to_json).Here 'id' field is mandatory in all json records and it should be uniq.
1313

14-
var people = [{person: {name: 'Jiren', age:26, country: 'India', country_id: 1,
14+
var people = [{person: {id: 1, name: 'Jiren', age:26, country: 'India', country_id: 1,
1515
states : [{ state : 'MH', state_id : 3 }, {state : 'HN', state_id : 4}] } },
16-
{person: {name: 'Joe', age:25, country: 'USA', country_id: 2,
16+
{person: {id: 2, name: 'Joe', age:25, country: 'USA', country_id: 2,
1717
states : [{ state : 'MH', state_id : 3 }, {state : 'HN', state_id : 4}] } }
1818
]
1919

@@ -120,6 +120,9 @@ Triggering the filter
120120
This will render each JSON object to html and append to '#people_list' div.
121121
Second arg is object render function which can be customized as show above.
122122

123+
NOTE: Initially where html element going to render and append must be empty.Here '#people_list' div is empty.
124+
125+
123126
Filter using link
124127
-----------------
125128

@@ -145,6 +148,22 @@ Bind event on filter link and clear filter link. Here on click link data-value s
145148
fJS.filter();
146149
});
147150

151+
Javascript Template Integration
152+
-------------------------------
153+
Template must have parent any html tag.
154+
i.e
155+
156+
incorrect:
157+
158+
<span class="name">{{name}}</span>
159+
<span class="age">{{age}}</span>
160+
161+
correct:
162+
163+
<div>
164+
<span class="name">{{name}}</span>
165+
<span class="age">{{age}}</span>
166+
</div>
148167

149168
Mustache.js integration
150169
-----------------------

0 commit comments

Comments
 (0)