This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Populating <TABLE> using Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Populating <TABLE> using Ajax" Watch "Populating <TABLE> using Ajax" New topic

Populating <TABLE> using Ajax

Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

Dear All,
I am having a client table in the database containing records of more than 100 clients. Using Ajax I had populated the <table> for the first 12 clients. Now what I am trying to do is

1. I provided two navigation button i.e Next and Previous
2. On clicking the Next button I should the next 12 clients from the database and the page does not have to get refreshed.
3. If Next is done then the same logic will apply for the Previous case but with slight modification.

Note:- I had taken only one td and using for loop i created 12 and id of the td's are assigned dynamically from the client table and equals to client id.

The logic I am working on it is

1. Get hold of the first and the last td, so by doing this, we get the start and end position of the next set of 12 clients
2. The next start position will be end+1 and the end position will be start+12

But here the question is how can I get hold of the tds. I cant use td's id attribute as those are generated dynamically and equals client's id.

If you people have better logic than this please tell me

Arpit U. Gadle

Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
I recommend you read into DWR

I has a nice set of utilities to handle tables with ajax
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Do not use code tags if you are not posting code. I edited so it can be readable once again.

You should not use code tags to get around the word filter. Use your vowels!

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Can't you just hold the state in which the table is in the session and send that up. When the user hits next, you use the session to move in the next direction?

Or you can hold the page number and number of rows visible and sed that up. It should not be that hard to calculate the next group on the server.

I agree. Here's the link:
subject: Populating <TABLE> using Ajax
It's not a secret anymore!