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

  • SEARCH
  • Home
  • 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 6083387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:23:52+00:00 2026-05-23T11:23:52+00:00

I just got amazing feedback for my previous question but now I’m stuck again.

  • 0

I just got amazing feedback for my previous question but now I’m stuck again.

I have a JQuery listview displaying my json array. It’s working fine.
But now, I’d like to be able to filter my results by name or price. I looked up the jQuery.grep() method but can’t really get it to work correctly.

If anyone could give some pointers on how I could get this to work, it would be greatly appreciated once again.

Heres the code I have so far :

js file :

    // Json array
    var productList = {"products": [
        {"description": "Product 1", "price": "9.99$"},
        {"description": "Product 2", "price": "9.97$"},
        {"description": "Product 3", "price": "8.52$"},
        {"description": "Product 4", "price": "5.24$"},
        {"description": "Product 5", "price": "4.21$"}
    ]
    };

function loadList() {

//  var list = document.getElementById('productList');
    var list = $("#productList").listview();
    list.sort();

   $(productList.products).each(function(index){
    $(list).append('<li id="listitem">' + this.description + "  " +
            "    :     " +  this.price + '</li>');

   });

   $(list).listview("refresh");

}<code>

HTML file :

<html>
<head>
<title>Product List</title>
&meta;
<script src="@=site.cfg.resources.url@/test.js"></script>

</head>

<body onLoad="loadList()">

<div data-role="page">

<div data-role="header" id="header">
<h1>Product List</h1>
</div>

<div data-role="content" id="content">
<ul id="productList" data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
</ul>
</div>

</div>

</body>
</html>

  • 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-05-23T11:23:52+00:00Added an answer on May 23, 2026 at 11:23 am

    .filter() should do what you’re looking for, I think.

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

Sidebar

Related Questions

I just got an email from twitter saying my keys have now been enabled
just got my views to change with AJAX, but now I'm stumped on how
Just got a new Windows laptop, installing emacs23 on it. My previous computers have
Just got this answer from a previous question and it works a treat! SELECT
I just got pagination to work on my site, but I wanted to use
I just got a job offer to be a FE Developer, but I've never
I just got this question on an interview and had no idea how to
I just got a Mac with OS X (10.6.8). What options do I have
I just got a new Mac (with Lion) and am setting everything up, but
Ok just got assigned to a new project and have never dealt with Javascript

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.