Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7800869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:46:31+00:00 2026-06-02T00:46:31+00:00

Im using the jQuery mobile search filter list: http://jquerymobile.com/test/docs/lists/lists-performance.html Im having somer performance issues,

  • 0

Im using the jQuery mobile search filter list:
http://jquerymobile.com/test/docs/lists/lists-performance.html

Im having somer performance issues, my list is a little slow to filter on some phones. To try and aid performance I want to change the search so only items starting with the search text are returned.

So ‘aris’ currently finds the result ‘paris’ but I want this changed. I can see its possible from the documentation below but I dont know how to implement the code.

http://jquerymobile.com/test/docs/lists/docs-lists.html

$("document").ready( function (){
  $(".ui-listview").listview('option', 'filterCallback', yourFilterFunction)
});

This seems to demonstrate how you write and call your own function, but ive no idea how to write it! Thanks
http://blog.safaribooksonline.com/2012/02/14/jquery-mobile-tip-write-your-own-list-view-filter-function/

UPDATE – Ive tried the following in a seperate js file:

$("document").ready( function (){

  function beginsWith( text, pattern) {
  text= text.toLowerCase();
  pattern = pattern.toLowerCase();

  return pattern == text.substr( 0, pattern.length );
  }

  $(".ui-listview").listview('option', 'filterCallback', beginsWith)

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:46:33+00:00Added an answer on June 2, 2026 at 12:46 am

    might look something like this:

    function beginsWith( text, pattern) {
    text= text.toLowerCase();
    pattern = pattern.toLowerCase();
    
    return pattern == text.substr( 0, pattern.length );
    }
    

    Basically you compare from 0 to “length” of what you’re matching to the source. So if you pass in “test”,”tester” it will see you’re passing in a string of length 4 and then substr “tester” from 0,4, which gives you “test”. Then “test” is equal to “test”… so return true. Lowercase them to make it case insensitive.

    Another trick to improve filter performance, only filter once they’ve entered more than 1 character.

    edit it appears jQueryMobile’s filter function expects that “true” means it was not found… so it needs to be backwards. return pattern != text.substr( 0, pattern.length );

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my mobile app I am using jquery mobile with multipage layout (one html,
I am using jquery Mobile 1.0. I have this html code. <label for=slider class=ui-hidden-accessible>
I am using Jquery mobile, and I have these two select lists, I want
I'm using Jquery mobile framework. I have 2 html files which has two buttons
I am trying to create a list using the styles provided by jquery mobile.
I am using <input type=search /> textboxes in a jQuery Mobile site. JQM provides
i have the following problem : I'm using Jquery mobile , user can search
I have a select option list and im using jQuery Mobile. My list is
I am using jquery mobile. I would like to navigate from one page to
I'm using jquery mobile in my express project. How could I use Ajax for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.