Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23601
| Message-ID | <9497456.rDsThJXBuM@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2014-03-14 10:59 +0100 |
| Subject | Re: Searching a multi page list |
| Newsgroups | comp.lang.javascript |
| References | <VMCdnQIlfLGx7b_OnZ2dnUVZ_h-dnZ2d@westnet.com.au> |
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
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