基于struts对象的属性更改jquery中的表(tablesorter)行颜色

时间:2014-06-11 23:28:07

标签: jquery struts tablesorter

我是jquery的新手。 需要一些帮助来根据struts对象属性更改行颜色,这有助于我迭代和构造表行。我猜bgcolor / fgcolor属性被jquery覆盖。

<%@ taglib prefix="s" uri="/struts-tags"%>                      
<link rel="stylesheet" type="text/css" href="themes/blue/style.css">
<link rel="stylesheet" href="js/themes/base/jquery.ui.all.css">
<script type="text/javascript" src="js/jquery-latest.js"></script>
<script type="text/javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" src="js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
<script type="text/javascript"
    src="js/jquery.tablesorter_modified4search.js"></script>
<script type="text/javascript" src="js/tablesorter_filter.js"></script>
<script type="text/javascript" src="js/jquery.jeditable.mini.js"></script>
<script type="text/javascript" src="js/jquery.jeditable.datepicker.js"></script>
<script type="text/javascript" src="js/autogrow.js"></script>
<script type="text/javascript" src="js/jquery.jeditable.autogrow.js"></script>

        <table id="myTable" class="tablesorter">
        <thead>
            <!--- header goes here -->
        <thead>
        <tbody>
        <s:iterator value="reghistory" id="reghistory">

              <s:if test="%{#reghistory.deadind.toString()=='Y'}">  
                <tr bgcolor="red">                    
              </s:if>
              <s:else>
                <tr fgcolor="blue">                   
              </s:else>                 
              <s:if test='%{#reghistory.reasoncde.toString()=="RS"}'>
                    <td onmouseover="this.disabled=true;"><b
                    class="editSelectable"
                    id='<s:property value="#reghistory.regname"/>;<s:date name="#reghistory.fromdt" format="yyyy-MM-dd"/>;<s:date name="#reghistory.actiondt" format="yyyy-MM-dd"/>;<s:property value="#reghistory.reasoncde"/>;reasoncde'
                    style="display: inline">Resolved</b></td>
              </s:if>
              <s:else>                    
                    <td onmouseover="this.disabled=true;"><b
                    class="editSelectable"
                    id='<s:property value="#reghistory.regname"/>;<s:date name="#reghistory.fromdt" format="yyyy-MM-dd"/>;<s:date name="#reghistory.actiondt" format="yyyy-MM-dd"/>;<s:property value="#reghistory.reasoncde"/>;reasoncde'
                    style="display: inline">Active</b><img src="img/icons/dead_ind.GIF"  height="14" width="14" title="Dead Indicator"> </td>
              </s:else>

                    <td onmouseover="this.disabled=true;"
                    id='<s:property value="#reghistory.regname"/>;<s:date name="#reghistory.fromdt" format="yyyy-MM-dd"/>;<s:date name="#reghistory.actiondt" format="yyyy-MM-dd"/>;<s:property value="#reghistory.reasoncde"/>;createddt'><s:date
                        name="#reghistory.createddt" format="dd/MM/yyyy HH:mm" /></td>
                    <td><s:property value="#reghistoryNew.user" /></td>                       

                </tr>
        </s:iterator>
        </tbody>
        </table>
        <script type="text/javascript" id="js">
            $(document).ready(function() {

                $("#historyTable").tablesorter({
                    stripingRowClass : [ 'even', 'odd' ],

                });
                $("#myTable").tablesorter({
                    stripingRowClass : [ 'even', 'odd' ],

                });
        </script>

0 个答案:

没有答案