Searchbar: search from start

i have added a searchable list to. i can trigger a search and it works perfect.

BUT: it will search anywhere in the string. in want to start the search from left, so when i type 12 i only want to match list items starting with 12… and not containting …12…


you will have to write your own search function

customSearch boolean

When enabled searchbar will not search through any of list blocks specified by searchContainer and you will be able to use custom search functionality, for example, for calling external APIs with search results and for displaying them manually

just as an example, i use it this way

this.searchbar = this.$f7.searchbar.create({
  el: '.searchbar',
  searchContainer: '.' + this.searchSelector,
  customSearch: true,
  searchIn: '.item-title',
  on: {
    search: this.searchbarSearch,
    enable: this.searchbarEnable,
    disable: this.searchbarDisable,
    clear: this.searchbarClear
async searchbarSearch (sb, query, previousQuery) {
  // Whrite your FIND logic here!
  if (query.length < 3) return
  this.$set(this.searchbarParams, 'query', query)
  let searchResult = await this.$
  this.$emit('search-result', searchResult)
  // console.log(query, previousQuery)