Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-11-2013, 06:28 AM   PM User | #1
Vytfla
New Coder

 
Join Date: Apr 2012
Posts: 84
Thanks: 4
Thanked 0 Times in 0 Posts
Vytfla is an unknown quantity at this point
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?
Vytfla is offline   Reply With Quote
Old 01-11-2013, 10:23 AM   PM User | #2
niralsoni
Regular Coder

 
Join Date: Mar 2008
Location: London
Posts: 143
Thanks: 3
Thanked 38 Times in 38 Posts
niralsoni is an unknown quantity at this point
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
niralsoni is offline   Reply With Quote
Old 01-14-2013, 01:31 AM   PM User | #3
Vytfla
New Coder

 
Join Date: Apr 2012
Posts: 84
Thanks: 4
Thanked 0 Times in 0 Posts
Vytfla is an unknown quantity at this point
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.
Vytfla is offline   Reply With Quote
Old 01-14-2013, 10:18 AM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,553
Thanks: 9
Thanked 480 Times in 463 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:15.2% IE7:0.5% IE8:8.4% IE9:8.5% IE10:8.5%

Last edited by rnd me; 01-14-2013 at 10:20 AM..
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:15 AM.


Advertisement
Log in to turn off these ads.