Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23601

Re: Searching a multi page list

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="ISO-8859-1"
Message-ID <9497456.rDsThJXBuM@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Fri, 14 Mar 2014 10:59:29 +0100
User-Agent KNode/4.11.5
Content-Transfer-Encoding 7Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: Searching a multi page list
Newsgroups comp.lang.javascript
References <VMCdnQIlfLGx7b_OnZ2dnUVZ_h-dnZ2d@westnet.com.au>
MIME-Version 1.0
Lines 35
NNTP-Posting-Date 14 Mar 2014 10:59:33 CET
NNTP-Posting-Host d82030ec.newsspool2.arcor-online.net
X-Trace DXC=n=73A0Efa5Hk:C4l9A;OcOA9EHlD;3YcB4Fo<]lROoRA8kF<OcfhCOKS7Z\0<aQO8ADZm8W4\YJNLYUVHKH;GI^GQ[i]d4;IM\Nf@RGcW=]e\G
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:23601

Show key headers only | View raw


Andrew Poulos wrote:

> I query a database and display the returned records in a list. If the
> list gets too long I split it and display only the first "page" (with
> next/back buttons to get to the other "pages").
> 
> I needed a search capability so I wrote one that can search a list and
> create a new list based on the matches. Alas it only works on a single
> list. If a big list is actually a series of multiple lists what's a
> decent way of adding a search capability?

Filter the data server-side, use XHR on the client to request the results, 
and the DOM to generate the markup.  Since you would probably prefer XHR 
anyway in order to get the latest data efficiently and user-friendly when 
turning the page, no major modifications to the business logic would be 
necessary.

The worse alternative is to send the client the whole list, but generate 
only a part of it (per page) either server-side or client-side.

> Should I have a "hidden" list with every item and then create the
> displayed list(s) from it?

Then it would not work without client-side scripting, and initial loading 
would take longer.  Also, the search would be on the last snapshot of the 
data, not necessarily the current data.

Note that either way you can cache the data server-side in a session, 
potentially reducing database load.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Searching a multi page list Andrew Poulos <ap_prog@hotmail.com> - 2014-03-14 13:57 +1100
  Re: Searching a multi page list Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-14 10:59 +0100
  Re: Searching a multi page list Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-15 00:13 +0000
    Re: Searching a multi page list Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-15 01:29 +0100

csiph-web