• 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

What the best way to retrieve thousand rows from database for encoding?

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to create a webpage such that there is an 'import' and 'save' button.

When the user clicks import button, it will retrieve inventories under PRODUCTS table which contains product title, SRP and Sold by (input field) under his account. Average possible returned rows will be around 1k-5k. If the 'Sold By' has value, it will show as read only. But if not, it will be editable.

Then the user has a list of product IDS printed on a paper that was sold by his employees and he has to scan each product id and put the name of his employee under Sold By and the price sold. This is a manual procedure..
Then after he finishes encoding, he has to click save button to save changes in the db.

Can you please suggest what is the best way to implement this? Is it efficient to use js functions such as datatables?
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Definitely use some kind of pagination. The jQuery DataTables approach would seem like a good fit.
Whatever you do make it as painless as possible for the user to work with. Manually cross-checking and updating 5K records is close enough to purgatory as it is, without having to wrestle a broken UI every step of the way.
 
Winston Liek
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply.

I was thinking of using pagination (something like 100 rows per page number). But I'm not sure if do I have to:
1. Send all data(~2000 rows) during get operation then use pagination to display 100 rows per page
2. Send only 100 row then calculate pagination and send ajax request when user clicks on page numbers

In terms of efficiency and I need to fast load it.
I think the best way is option 2. However, if I choose option 2, how will the user save his encoded data on current page if he will navigate to the next/other page?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Liek wrote:1. Send all data(~2000 rows) during get operation then use pagination to display 100 rows per page


Why grab data that you are not going to display?

Send only 100 row then calculate pagination and send ajax request when user clicks on page numbers


Better. Again, why bother fetching data that's not going to be used?

In terms of efficiency and I need to fast load it.


When and if you discover a performance issue, it can be addressed. Until such a time, anything else is premature optimization.

how will the user save his encoded data on current page if he will navigate to the next/other page?


I don't know what you mean by a user "saving his data".
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. If you decide to use jQuery Datatables in paging mode, it will handle making the requests for the data it needs.
 
Winston Liek
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

Winston Liek wrote:1. Send all data(~2000 rows) during get operation then use pagination to display 100 rows per page


Why grab data that you are not going to display?

What I mean is I will return all the data when the page initially loads then use pagination... So that when the user clicks next page/desired page, it will not send request since the data is in the user's page already(just hiding it)


Send only 100 row then calculate pagination and send ajax request when user clicks on page numbers


Better. Again, why bother fetching data that's not going to be used?



Part of the requirement is that the user won't have any filtering functionality (such as input id to filter then click search) since almost all will be encoded once finished.
We need to display the table when the page is loaded. It's just a matter of how will we display all the results


In terms of efficiency and I need to fast load it.
When and if you discover a performance issue, it can be addressed. Until such a time, anything else is premature optimization.

how will the user save his encoded data on current page if he will navigate to the next/other page?


I don't know what you mean by a user "saving his data".



Since each row in the table has input type text fields and we will be using pagination. For example, the result have 10 page numbers. The user inputs on the first page then finished encoding on the first page. If he clicks 'Next' button and I used option 2, the encoded data on page 1 will be discarded and moved to page 2.

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Liek wrote:
What I mean is I will return all the data when the page initially loads then use pagination... So that when the user clicks next page/desired page, it will not send request since the data is in the user's page already(just hiding it)


If the data set is fairly small that can work. But it doesn't scale to large data sets. On one of my apps, we just switched from client-side to server-side paging because of performance issues.

By the way, DataTables can work in either mode -- you can feed it the whole set on the client, or you can tell it to fetch from the server as needed.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic