-2

I am using AJAX to display a table, I need to sort that rendered table at client side using JavaScript or jQuery or whatever is best.

I tried jQuery it is working fine when page is loaded but by dynamically writing html content into a div and there by sorting that rendered table is not working.

I think the problem is JavaScript is not working while rendering, I wrote some script alert while rendering html these tags works while rendering a page.

halfer
  • 19,824
  • 17
  • 99
  • 186
Raviraja
  • 406
  • 2
  • 5
  • 17
  • Did you try [jQuery tablesorter](http://tablesorter.com/docs/)? – Salman A Jul 01 '11 at 13:33
  • What is "not working" supposed to mean? What does your code look like? Can you show us an example that demonstrates the issue, or shall we just guess? – Lightness Races in Orbit Jul 01 '11 at 13:36
  • @salman: Yes i tried jQuery it is working fine for page level rendering but the problem here is jquery sort table or any javascript tags are not getting called while rendering a div... – Raviraja Jul 01 '11 at 13:37
  • Need more code. Are you using `document.write()`s? – Salman A Jul 01 '11 at 13:39
  • No I am using PHP to send the respond text... ANd there if i keep any javascript alerts there are not getting execute..:( – Raviraja Jul 01 '11 at 13:41
  • yes, how are you calling the PHP? with the update JS function you are using, setup a callback function – GBa Jul 01 '11 at 14:51

1 Answers1

3

By using tablesorter plugin:

$("table").tablesorter();

re-running each time table is affected (i.e it will not be enought to run this command once when page loading is complete)

Ēriks Daliba
  • 708
  • 4
  • 4