Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    84
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Filtering by keywords

    So, I hope this goes here. I'm not familiar with any javascript or jquery but am looking for help. A search function I want on my site is for the user to choose one or two different presented options (example- my site has on one side A, B, and C, and on the other RED, GREEN, and BLUE- so the user either choose just C, or chooses C and RED). Then, when they hit "next" it loads a new page and filters from a large list and only shows what the user wanted (either C or C&RED).

    What kind of code would I be looking at? Would anyone be willing to help me work through this?

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Location
    London
    Posts
    152
    Thanks
    4
    Thanked 42 Times in 42 Posts
    Where is your so called 'Large List' located ?
    (A) Is it in some database, at server side ?
    (B) or is it HTML table contents ?

    If its option (A), then you need to pass the filter parameters to the server for processing it and then return back the required subset.

    If its option (B), then you are lucky enough. I have recently wrote a solution for the same. Its available online at - Data Analyzer: HTML table to Chart From this article, you can bypass the "Chart" section, and simply use the utility to filter your data.

    Let me know if you have any problem in using that code...

    Hope it helps you out...

    Regards,
    Niral Soni

  • #3
    New Coder
    Join Date
    Apr 2012
    Posts
    84
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Okay, I should elaborate. I'm not looking to display data in a chart or anything like that. I'm looking at a sort of linkedin search where if you type in an industry and/or location, the next page will display all the people that fit the search. As of right now there is no list and I need to create it, so I am looking for the best way to do that.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,188
    Thanks
    10
    Thanked 569 Times in 550 Posts
    if you are going to have more than 100 or so items, i would recommend creating a DB to store the information. that way, you can later re-group on the fly as needed, for example by place, by rating, by name, by age, etc...

    you can then use html to show the DB's data on the web.

    typically this is done with php>html (semantic) -or- php>JS>html (ajax).

    if you say "The next page", that seems to imply the first combo, since ajax can all run at once without reloading. it's a balancing act: searching local data is going to be faster than searching remote data, but sometimes there's too much data to load it all up-front. a phone book fits in JS, no problem, but google's index? not even slightly.


    the DB itself can create the specific selections, you simply turn the result list into something people want to look at and use.

    if you store all the info client-side, you would do that filtering using javascript. there are lots of so-called "nosql" tools to make this simpler than hand-writing all the filters yourself. You can even find simple SQL layers to sit atop an array of javascript objects. there are others like taffyDB that have a VERY simple query interface. the problem is death by variety more than nothing to eat.

    now, most browsers themselves include a powerful DB (webSQL or indexedDB), but those are pretty complex beasts and you don't need them for the task described.

    you can do it client side if you have say, less than 2MB of data in whole. if it's really good/rare data people might wait upfront for 5-10MB of JSON, if they are going to see several views once it loads up. after that, it's time to buy a webplan that includes a DB so you can dish out result lists instead of full tables. This is slower each time than client-side searching, but quicker upon page landing.

    and of course, just for confusion, most pro sites these days use hybrids: you store all the data server side, but deliver 5 pages of results on a search, letting the client paginate/re-order those results as needed, lowering traffic on the server and enabling instant table resorts...
    Last edited by rnd me; 01-14-2013 at 10:20 AM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •