Closed zenitogr closed 11 months ago
this works: so should I just conditionaly hide the tile div with a style="display:none"?
{{#partial users}}
{{#each users}}
<div class="tile">
<span><img class="img-circle" src="{{.picture}}" /></span>
<span style="text-transform: capitalize;">{{.first_name}} {{.last_name}}</span>
<span>{{.email}}</span>
</div>
{{/each}}
{{/partial}}
for anyone having the same issue I solved it this way:
{{#partial userList}}
<a href="#" on-click="@this.set('view', 'list')"><h3>Movies <small>Single page app!</small></h3></a>
<a href="#" on-click="@this.set('view', 'myProfile')"><h3>My Profile</h3></a>
<h1>User List</h1>
<button class="btn btn-success" on-click="@this.addUsers(1)">Add 1 user</button>
<button class="btn btn-success" on-click="@this.addUsers(100)">Add 100 users</button>
<button class="btn btn-success" on-click="@this.set('users', [])">Clear</button>
<input class="form-control" value="{{user_filter}}" placeholder="Search user..." />
<hr/>
{{>users}}
{{/partial}}
{{#partial users}}
{{#each users}}
<div class="tile {{#if (.first_name.search(user_filter)==-1)}}hidediv{{/if}}" >
<span><img class="img-circle" src="{{.picture}}" /></span>
<span style="text-transform: capitalize;">{{.first_name}} {{.last_name}}</span>
<span>{{.email}}</span>
</div>
{{/each}}
{{/partial}}
```
.hidediv {
display:none;
}
Description:
I am trying to show a list of users and when I input a search term in an input tag I want the list to show only the items that include that search term
I have seen the demos and examples and the dataset example but cant make it work.
I am trying this:
if the search input
is this declaration corrent?
and the file ractive-dataset.js is: