日期:2014-05-16  浏览次数:20407 次

j2ee中table有2个需求,1.对某些列的行进行去重,2.对某些列支持正反排序,这两个功能会起冲突,贴出源码,求大家指导!
本帖最后由 qiuqiu_henry 于 2013-08-15 15:15:12 编辑
1.下面是jsp的table部分的代码:
  <table class="table-css" id="showList" style="margin-left: 1px;">
  
    <thead>
    <tr role="head">
    <th style="width:135px"></th>
     <th sort="true" width="144px">aaa</th>
     <th style="width:48px"></th>
  <th style="width:116px"></th>
  <th style="width:120px"></th>
      <th style="width:136px"></th>
   <th style="width:88px"></th>
    <th style="width:145px"></th>
   <th style="width:124px"></th>
     </tr>
    </thead>
  
<tbody>
<s:iterator value="data" id="date1" status="st">
<tr>
<td style="width:135px"><s:property value="date" /></td>
<td style="width:144px"><s:property value="time" /></td>
<td style="width:48px"><s:property value="userip" /></td>
<td style="width:116px"><s:property value="servclass" /></td>
<td style="width:120px"><s:property value="serverip" /></td>
<td style="width:136px"><s:property value="gotoclass" /></td>
<td style="width:88px"><s:property value="state" /></td>
<td style="width:145px"><s:property value="WTserverip" /></td>
<td style="width:124px"><s:property value="usernum" /></td>
</tr>
</s:iterator>
</tbody>
  </table>


2:下面这段js是用来某一列的行去重的。
function table_rowspan(table_id,colnum){  
var table_firsttd = "";
var table_currenttd = "";
var table_SpanNum = 0;
var table_Obj = $(table_id + " tr td:nth-child(" +colnum + ")");
 table_Obj.each(function(i){
 if(i>0){
 $(this).css("color","#1E47BC"); 
 }
 if(i==0){
 table_firsttd = $(this);