从数据库获取的表格里的内容用SortableTable进行排序
以下是html数据内容
<table id="dataTable" width="95%" border="1" align="center" cellpadding="2" class="bg2"> <thead> <tr> <th nowrap="nowrap" class="center" > 序号 </th> <th nowrap="nowrap" class="center"> 代理人 </th> <th nowrap="nowrap" class="center" valign="middle"> 申请类型 </th> <th nowrap="nowrap" class="center" valign="middle"> 货物品名 </th> <th nowrap="nowrap" class="center" valign="middle"> 预计提箱日期 </th> <th nowrap="nowrap" class="center" valign="middle"> 联系人 </th> <th nowrap="nowrap" class="center" valign="middle"> 电话 </th> <th nowrap="nowrap" class="center" valign="middle"> 申请状态 </th> <th nowrap="nowrap" class="center" valign="middle"> 操作 </th> </tr> </thead> <% int i = 0; %> <logic:iterate name="lssqdListForm" property="lssqdlist" id="lssqdlist" indexId="index"> <tr style="BACKGROUND-color:#FFFFCC" mce_style="BACKGROUND-color:#FFFFCC"> <% i = i + 1; %> <td class="center" height="30px"> <%=i%> </td> <td class="center" height="30px"> <bean:write name="lssqdlist" property="dlsqc"/> </td> <td class="center" height="30px"> <param:display type="sqlxTag" name="lssqdlist" property="sqlx" /> </td> <td class="center" height="30px"> <bean:write name="lssqdlist" property="pmmc" /> </td> <td class="center" height="30px"> <bean:write name="lssqdlist" property="yjtxtimeStr" /> </td> <td class="center" height="30px"> <bean:write name="lssqdlist" property="lxr" /> </td> <td class="center" height="30px"> <bean:write name="lssqdlist" property="gddh" /> </td> <td class="center" height="30px"> <param:display type="ztflag" name="lssqdlist" property="ztflag" /> </td> <td class="center" height="30px"> <!-- ${lssqdlist.ztflag}--> <logic:equal name="lssqdlist" property="ztflag" value="0"> <a href="#" mce_href="#" οnclick="forup(<bean:write name="lssqdlist" property="id" ></a>,<bean:write name="lssqdlist" property="sqlx" />)"><font color="red"> 修改</font> </a>| <a href="#" mce_href="#" οnclick="remove(${lssqdlist.id},${lssqdlist.sqlx})"> <font color="red">删除</font> </a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="3"> <a href="#" mce_href="#" οnclick="forup(<bean:write name="lssqdlist" property="id" ></a>,<bean:write name="lssqdlist" property="sqlx" />)"><font color="red"> 修改</font> </a>| <a href="#" mce_href="#" οnclick="remove(${lssqdlist.id},${lssqdlist.sqlx})"><font color="red"> 删除 </font></a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="1"> <a href="#" mce_href="#" οnclick="read(${lssqdlist.id},${lssqdlist.sqlx})"><font color="red">查 看 </font> </a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="2"> <a href="#" mce_href="#" οnclick="read(${lssqdlist.id},${lssqdlist.sqlx})"> <font color="red">查 看 </font></a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="4"> <a href="#" mce_href="#" οnclick="read(${lssqdlist.id},${lssqdlist.sqlx})"> <font color="red">查 看 </font></a> </logic:equal> </td> </tr> </logic:iterate> </table>
以下是JavaScript内容
<script language="javaScript">
var st1 = new SortableTable(document.getElementById("dataTable"),
'onMouseOnTr', [ "Number", "String", "String", "String", "String",
"String", "String"]);
</script>
注意那个thead 还有tbody的填写。
不能乱写。