aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Dynamic table jQuery sort adding old rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dynamic table jQuery sort adding old rows" Watch "Dynamic table jQuery sort adding old rows" New topic
Author

Dynamic table jQuery sort adding old rows

Kumanan Guna
Greenhorn

Joined: May 07, 2013
Posts: 9
Hi,

I need help to fix jquery sortable issue for dynamic table.

I have one customer html table and onclick making db call, then populating the output in dynamic table. Output always change, because it's based on timestamp (don't have any issues with output here.)

Problem comes after populating dynamic rows and when I try to sort by clicking table header getting old records also in the table. Please help.

for example:

First time Dynamic Table shows.

A B C

Second time Dynamic Table shows below when i try to sort. But table suppose to have only D E F row.

A B C
D E F


Thanks.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

As the AJAX example shows, you are appending data each time. If you want to remove data, I think you'd need to re-initialize the table each time. This example shows how to initialize it up front. You'd need to change the code to do it each time.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kumanan Guna
Greenhorn

Joined: May 07, 2013
Posts: 9
Jeanne Boyarsky wrote:As the AJAX example shows, you are appending data each time. If you want to remove data, I think you'd need to re-initialize the table each time. This example shows how to initialize it up front. You'd need to change the code to do it each time.




Hi Jeanne,

The example shows those are static tables.

In my case, i get a respose in XML, iterating through out all element in xml and adding each rows in a table. Also before adding any rows, i m deleting all rows in table and start adding new rows.



I don't have any problem in adding and deleting rows in table.

Once data is available in table, when I try to sort table appending with previous results also.

For example, first time i try to sort 10 rows, 2nd time I got a new 3 result and try to sort, table appending with 13 (old + new records). Is there any cache tablesorting storing this information ? Do I need to clear the cache before appending new data ?

Thanks.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

It doesn't sound like you want to append new data. It sounds like you want to do a replace (which is clear the table and add all the existing records.) The reason is that simply appending new data doesn't tell you if data has been deleted from the source table.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic table jQuery sort adding old rows