aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Populating <TABLE> using Ajax" Watch "Populating <TABLE> using Ajax" New topic
Author

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

Regards,
Arpit U. Gadle


Gerardo Tasistro
Ranch Hand

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

http://directwebremoting.org/dwr/index.html

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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating <TABLE> using Ajax
 
Similar Threads
How to getParameter value
usebean getProperty and setProperty in the same form field
resultset is not working properly
Problem with updating values
how to getSession in simple java class?