• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Dynamic table jQuery sort adding old rows

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Kumanan Guna
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Get out of my mind! Look! A tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic