backbonejs-searchbar
v1.0.7
Published
Backbone js searchbar for searching through colllections or even models inside of collection to return a list of all results
Downloads
10
Readme
BackboneJS Search bar function
The backboneJS searchbar easily implementable. Searches collections and models inside of collections
Basic Usage
The BackboneJS search bar is shipped as a view initially, but you specify options on the fly:
Sample Code
var items = [
{ name:'test',
value:'test'
},
{
name:'test2',
value:'test2'
}
]
var sb = new Searchbar({
searchAttr: 'value',
items:items
});
// To append to a document on ready
$(document).ready(function(){
$('body').append(sb.render());
$('#testbtn').on('click',function(){
console.log(sb.getResults());
});
sb.onInput(function(e) {
console.log('inside of callback');
console.log(e.resultSet);
})
});