The row coloring is done on client-side (with tablesorter itself). It
works on document load. However, after sorting, all rows become the
same color. Why is row coloring not preserved after sorting? What can
be the reason?

Here is a snippet:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<div class="table">
<table width="100%" cellspacing="1" id="tableID">
<thead>
        <tr>
                <th class="columnTitle">Text</th>
                <th class="columnTitle">Text</th>
        </tr>
</thead>
<tbody>
        <tr class="even">
                <td>Text</td>
                <td>
                        <span class="hidden">Number</span>
                                Time
                </td>
                <td>
                  <table>
                        <tr>
                                <td></td>
                        </tr>
                  </table>
                </td>
        </tr>
        <tr class="odd">
              .....
        </tr>
</tbody>
</table>
</div>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$(document).ready(function() {
    $("#tableID").tablesorter({
        headers: {

                4: {
                           sorter: 'time'
                           }

                },
                widgets:['zebra'],
                widgetZebra: {css: ["even","odd"]}
    });

});
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.odd {
background-color: ...
}
.even {
background-color: ...
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

On Dec 18, 7:08 am, MorningZ <morni...@gmail.com> wrote:
> "I was trying to fix that with Zebra
> widget but gave up."
>
> Well, thistablesorterplugin most definitely does work, both on load
> and client sorting....
>
> i'd suggest being more descriptive on why you gave up (explanation?
> example code?  question to clarify what it does?), instead of trying
> to recreate code that already works
>
> On Dec 17, 10:41 pm, adeveloper <msosn...@gmail.com> wrote:
>
> > My table has alternating row coloring. It get's messed up after
> > sorting (eg, instead of odd, even, odd I get something like even,
> > even, odd, even, even...etc) I was trying to fix that with Zebra
> > widget but gave up.
>
> > All I need to do is to call this simple function 
> > tohttp://www.sitepoint.com/article/background-colors-javascript/, but I
> > am not sure where. I tried putting into:
> > <body onload="....
>
> > It worked, however, only when document itself was reloaded, not after
> > client-side sorting withtablesorter.
>
> > How to call this function from jQuery? Is it possible to add it to $
> > (document).ready(function()  call?

Reply via email to