Hi folks,

Using jquery's tablesorting, I've been trying to sort a table that
contains data loaded   dynamically/programatically using DWR's addrows
method.  The sorter would sort any column I pick but could only do so
in one direction ( i.e. descending order only, not toggable between
asc/desc ) and then I'd be getting  a "cache.normalized[0] is
undefined" error message right after the sort. There was no problem
when sorting data from statically nested table rows , as done in the
demos.

Here's how I set up the table for sorting:

JSP:

<script type='text/javascript' src='<%=contextPath%>/js/jquery/
jquery-1.3.2.js'></script>
<script>
   var $j = jQuery.noConflict();   // to avoid conflict with Prototype
</script>
<script type='text/javascript' src='<%=contextPath%>/js/jquery/
jquery.tablesorter.js'></script>
....

<table id= "table1" width="100%"  class="tablesorter">
       <thead> ...
       <tbody id="tbody1" >...   //  rows inserted through DWR method
upon click event
       <tfoot> ...
</table>

Javascript:

loadData() {
      ...  // table rows and cells set up here
    // populates the table with sample data
    dwr.util.addRows(tablename,[ 'Africa', 'America', 'Asia',
'Australasia', 'Europe' ],cellFuncs,tableproperties);
     $j("#table1").tablesorter() ;   // intiliaze tablesorter.Tried  $j
("#table1").trigger("update") here but didn't work

}

With the above in place, what I got  when I clicked a column's header
was one way sorting, with the arrow changing from neutral to  downward
arrow, then finally a complaint "cache.normalized[0] is undefined".
Any succeeding clicks on the same column header would yield no
results. On the other hand, clicking any other column header would
trigger a one way sort again, and yields the same behavior.

What could I be missing here?  Please share your thoughts on how I can
get the sorter to work properly. Also, take note that my table is
paginated (not by jquery though) which i hope doesn't complicate the
sorting process.

Reply via email to