I need to implement Custom Search in Framework7

Viewed 3621

I have a 2 set of array , 1st with the whole array set, 2nd with the first 10 array (2nd is the displayed in the UI). I have implemented the search for the list view.

But i need to search from the whole list of array.

<form class="searchbar searchbar-init" data-search-list=".list-block-search" data-search-in=".item-title" data-found=".searchbar-found" data-not-found=".searchbar-not-found">
                    <div class="searchbar-input">
                       <input type="search" placeholder="Search">
                       <a href="#" class="searchbar-clear"></a>
                    </div>
                    <a href="#" class="searchbar-cancel">Cancel</a>
                 </form>
2 Answers

This is how I'm able to make it work using customSearch and using ajax Call

I'm using Framework7 v3.1.1

var searchbar = app.searchbar.create({
  el: '.searchbar',
  customSearch: true
});

searchbar.on('search', function()
{
  $.ajax({
    url: 'http//:url.com?search='+searchbar.query,
    type: "GET"
  }).fail(function() {}).done(function(data)
  {
    //this is to remove the overlay after the search is done
    $('.searchbar-backdrop').removeClass('searchbar-backdrop-in');
  });
});

Related