I have a table of data brought in through lift and in it is a status
column.  I am wondering if there is an easy way to color a row based
on the contents of that column. Any status of broken was red, edited
was yellow and finalized was green.  It seems like I could write a
widget for doing this, but I don't know how it would work and have
little experience with creating my own widgets.I don't think linking
any of my code would really help the cause, but here is the
initialization which includes functions for mouseover color changes.

  <script type="text/javascript">
    $(document).ready(function() {

        //  Adds "over" class to rows on mouseover
        $(".tablesorter tr").mouseover(function(){
            $(this).addClass("rowHover");
        });

        //  Removes "over" class from rows on mouseout
        $(".tablesorter tr").mouseout(function(){
            $(this).removeClass("rowHover");
        });

        $('.tablesorter selectThisRow').click(function() {
            $(this).parent('tr').addClass('selected');

        });


        $("#claims").tablesorter(
        {

            sortList:[[4,0],[6,0]],
            widgets: ['zebra'],
            headers: {
                0: {  sorter: false },
                1: {  sorter: false },
                2: {  sorter: false },
                3: {  sorter: false },
                5: {  sorter: false },
                7: {  sorter: false },
                8: {  sorter: false }
            }
        })
        .tablesorterPager({container: $("#pager")});
  });
  </script>

I'm working with scala and lift as well so I'm bringing in the table
data from a database when the page loads.

Any advice would be helpful here, whether you think a widget is how to
make the colors adjust, or creating more JS functions for doing it.

Thanks in advance,

Chris

Reply via email to