• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which is better approach ?

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day,

I'm about developing a solution, which include features like sorting with different criteria based on user options (dropdown) and pagination for product review from customers.

My question for sorting,
a ) should I fetch all review data and append it to a designated DIV by hiding it using CSS, and show it by applying jQuery filter and display the necessary when user select specific option ?

b) I should do an ajax call when user select the option by having logic in controller to filter and return me necessary data?

c) When doing pagination, user click on specific page number, would it better to have a call to controller to query and return necessary data or I can append all data in DIV and making all page number by divide it with total item per page, when user click on number, i use jQuery to pick the necessary data to display out to user.

which approach(putting all data into client/browser or separate call for specific set of return data) is better and what is the pro and cons of it ?

Thanks in advance !

 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nakataa Kokuyo wrote:Good day,

I'm about developing a solution, which include features like sorting with different criteria based on user options (dropdown) and pagination for product review from customers.

My question for sorting,
a ) should I fetch all review data and append it to a designated DIV by hiding it using CSS, and show it by applying jQuery filter and display the necessary when user select specific option ?

b) I should do an ajax call when user select the option by having logic in controller to filter and return me necessary data?

c) When doing pagination, user click on specific page number, would it better to have a call to controller to query and return necessary data or I can append all data in DIV and making all page number by divide it with total item per page, when user click on number, i use jQuery to pick the necessary data to display out to user.

which approach(putting all data into client/browser or separate call for specific set of return data) is better and what is the pro and cons of it ?

Thanks in advance !



It will be much simpler to use ajax ( option b). All the web frameworks I've worked with (since the age of ajax) use this approach. SO much simpler than downloading all of it, hiding some of it and then using the division you are proposing to know which to hide.

 
Nakataa Kokuyo
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply Tim!

By having approach b. which caused the server busy, my mind to have all data in client side, and use jquery to filter the necessary so it only have one call to fetch all data...
the reason why solution by pulling all data into client is mainly concern of performance.

one note to highlight - our solution is place into e-commerce web site and many user click on it.

with my assumption above, is option b. still the best choice ?

 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are too many variables for me to know which is better for you. You are going to have to weigh the pros and cons you have laid out and maybe test it both ways to see if the performance of the ajax pagination is acceptable.
reply
    Bookmark Topic Watch Topic
  • New Topic