簡體   English   中英

在Struts2中使用JQuery表排序器

[英]Using JQuery table sorter in Struts2

我的問題主要是從jquery使tablesorter正常運行。 我認為問題源於我使用迭代器顯示表信息的事實-這是我設計struts2頁面的方式所必需的。

首先,我將jquery-1.11.1.min.js文件放在我的WEB-INF / lib文件夾中。 我覺得這是個方便放置的地方。 因此,我在jsp頁面中的標簽如下所示:

 <head>
      <script type="text/javascript" src="/My_Project/WebContent/WEB-INF/lib/jquery-1.11.1.min.js"></script>
      <script type="text/javascript" src="/My_Project/WebContent/WEB-INF/lib/jquery-1.11.1.min.tablesorter.js"></script>
      <script type="text/javascript">
         $(document).ready(function() {
            $("#table").tablesorter();
       });
      </script>
 </head>

然后我體內的桌子如下:

 <table id="table" class="tablesorter">
      <thead>
           <tr>
                <th>column</th>
                <th>column</th>
           </tr>
      </thead>
    <tbody>
        <s:iterator status="stat" value="listTable">
            <TR>
                <TD><s:property value="%{row1}" /></td>
                <TD><s:property value="%{row2}" /></td>
            </TR>
        </s:iterator>
    </tbody>
</table>

我的問題是,我想念什么? 迭代器是為什么我無法使表排序器正常工作嗎? 是我的格式嗎?

任何幫助信息或更好的例子將不勝感激。

遵循此jsFiddle。 hjsfiddle.net/Mottie/4mVfu/1/

您會發現自己所缺少的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM