How can I programmatically trigger the searchbar?

Hi\ I use framework 7 for a mobile app and have problem with searcbar. The issue is searhbar work quickly and brings results before actually result result , in this case brings no results, and brings result only after I manuely go 1 character back with mouse , then it gets triggerred and brings previous result

In docs it is written that searchbar has this method which forces searchbar to search passed query but I do not know how will I manuelly access searchbar I created in theml html section with the code below ?

When I search for static data search works OK, problem comes when I search for an external directory which brings results few seconds later, I think issue it searchbar is not designed for external search, it searches static data well and in my case I need few seconds delay between search triggered and get the result… btw, I use an API for external search in my actions file and get results via state in a computed method.

I just tried to put the delay in computed method before returning search data , but it didnt help. I tried to put return statement inside setTimeout method or after it but didnt worked for me. (actually putting it inside it doesnt return anything)

f7-searchbar(disable-link-text="Cancel" search-container="#searchList" placeholder="Search in contacts" :clear-button="true" @searchbar:search="onSearch" @searchbar:enable="onEnable" @searchbar:disable="onDisable" @searchbar:clear="onClear")

search related methods

    onSearch: function(query, found) {
      if (query.value !== '') {
        this.$store.dispatch('search', query.value);
      setTimeout(() => {
        this.dene; // this.$store.dispatch('search', query.value);
      }, 2000);
    onClear: function(event) {
    onEnable: function(event) {
      this.isSearch = true;
    onDisable: function(event) {
      this.isSearch = false;

computed method

  computed: {
    ...mapGetters(['contacts']), // not used anymore, instead store.state used
    getContacts() {
      var resultArray = [];
      let contactSource = this.$store.state.contactSource;
      if (contactSource === 'personal') {
        let sortBy = this.$store.state.sortBy;
        if (sortBy === 'firstName') {
          this.contacts = _.sortBy(this.$store.state.contacts, [
            function(o) {
              return o.firstName;
        } else {
          this.contacts = _.sortBy(this.$store.state.contacts, [
            function(o) {
              return o.lastName;
        return this.contacts;
      } else {
        setTimeout(() => {
          return this.$;
        }, 5000);

No, it is a bit wrong approach. By default, Searchbar does the search by already rendered list. If you have data from other place (like you are doing an XHR request) or any async request, then you should use customSearch and render data manually. In your case, if use Vue it should be even easier. So you need to enable customSearch and render items in list based on search query that you have by searchbar

thanks, I found an example like this, and I have already onSearch method, cant understand logic here\ other than adding customSearch property what should I do ?

It says “You need to initialize the search bar with the customSearch option set to true” and hen creates searchBar in the code instead of html section, cant understand that.

var searchBar = myApp.searchbar('.searchbar', {
    customSearch: true,
    onSearch: function(s) {
        console.log('Searching', s);
    onClear: function(s) {
        console.log('Clearing', s);

Can you just give an example how can I use query with search ? btw, I use same searchbar both for static (already rendered list) search and async search, how can I do it ?

Example you found is for v1. Here is how you usually do the things in Vue:

  <f7-searchbar custom-search @searchbar:search="onSearch"></f7-searchbar>
    <f7-list-item v-for="item in foundItems">...</f7-list-item>

export default {
  data() {
    return {
      foundItems: [],
  methods: {
    onSearch(query) {
      // based on query set something to foundItems array

So I should use search-container for searchbar ?

and inside onSearch(query) method, I will have to to get results from API call then ?

No, they are not connected and shouldn’t be in this case

so I have this and onSearch method in methods, and use computed property instead of data, shouldn the list be updated everytime state value changed ? but still same problem continue, changes only after I go back one character

f7-searchbar(customSearch=true, disable-link-text="Cancel" placeholder="Search in contacts" :clear-button="true" @searchbar:search="onSearch" @searchbar:enable="onEnable" @searchbar:disable="onDisable" @searchbar:clear="onClear")

I solved the issue by putting a buffer before API search, I am not sure whether the issue is related to custom search., it goes to onSeach method anyway …?

setTimeout(() => {this.$store.dispatch('search', query.value);}, 2000);