backbonejs-searchbar

1.0.7 • Public • Published

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);
    })
});

Package Sidebar

Install

npm i backbonejs-searchbar

Weekly Downloads

1

Version

1.0.7

License

ISC

Unpacked Size

134 kB

Total Files

10

Last publish

Collaborators

  • owchzzz