Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JQuery and cfquery

Posted on 2013-12-02
5
Medium Priority
?
430 Views
Last Modified: 2013-12-10
I current have a page where I load an query when page load, and it generate a table of content. Current I have a pagination system that will make an AJAX call to the DB and return a query with the start row and end row.

Now my question is, is it better to load all the data from the query in an array, json or any other format and use AJAX to query that result set and not make the call to the DB anymore?
0
Comment
Question by:Medrise
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 1336 total points
ID: 39691468
All depends on how much data you're loading. Pulling everything at once saves trips to the db, but the browser still has to parse it all and trying to parse a LOT of data can cause a browser freeze or get bogged down. If it's a small amount of data,it doesn't make much difference. Either way is fine.  However, once you move beyond that it's typically better to pull a page of data (10,20,50 records..) at a time to get the best balance of browser and server performance.
0
 

Assisted Solution

by:Medrise
Medrise earned 0 total points
ID: 39691528
_agx_ Thanks for the reply... It will depend on the user, some user will have a few records (10 to 50) and some may have 100 to 1000 records...

I guess I will keep like I have right now.  I have a stored procedure that takes a start row and end row... I guess it would be better to keep like that.
0
 
LVL 16

Assisted Solution

by:Gurpreet Singh Randhawa
Gurpreet Singh Randhawa earned 664 total points
ID: 39691793
Well for that such of work, I would prefer DataTables Jquery Plugin, server side code very easy and configurable to use

2. You can either use cfgrid to have such functionality where data comes in chunks and it does not freeze the browser anywhere

DataTables is more better as data comes in JSON format from backend and easy to display on screen

as AX Pointed out, loading much data will freeze the browsers and may not be a viable solution to work

if you have very little data i just suggestgo by the cfdiv way, the below post will help

http://www.raymondcamden.com/index.cfm/2008/12/14/Ask-a-Jedi-Simple-ColdFusion-8-Ajax-Pagination
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 1336 total points
ID: 39692782
(Edit)

@Medrise - Yeah, if the number of records is potentially unlimited, then sticking with db side pagination is better. If you pull all the data across into the browser, it might work swimmingly for some users (10-50 records) but terrible (or not all) for others with more records.  (Side note, the ExtJS site is a good example of too much javascript activity IMO. It works on one of my computers ok, but frequently freezes the browser on another due to too much javascript activity). Sticking w/db pagination will provide good balance of consistency and performance on both the db and browser side for all users.
0
 

Author Closing Comment

by:Medrise
ID: 39708053
Thanks for all the info...
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question