从数据库获取的表格里的内容用SortableTable进行排序

本文介绍了一种使用SortableTable插件对从数据库获取的数据进行排序的方法。通过具体的HTML和JavaScript代码示例,展示了如何设置表格结构及应用SortableTable进行交互式排序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

从数据库获取的表格里的内容用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="#" onclick="forup(<bean:write name="lssqdlist" property="id" ></a>,<bean:write name="lssqdlist" property="sqlx" />)"><font color="red"> 修改</font> </a>| <a href="#" mce_href="#" onclick="remove(${lssqdlist.id},${lssqdlist.sqlx})"> <font color="red">删除</font> </a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="3"> <a href="#" mce_href="#" onclick="forup(<bean:write name="lssqdlist" property="id" ></a>,<bean:write name="lssqdlist" property="sqlx" />)"><font color="red"> 修改</font> </a>| <a href="#" mce_href="#" onclick="remove(${lssqdlist.id},${lssqdlist.sqlx})"><font color="red"> 删除 </font></a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="1"> <a href="#" mce_href="#" onclick="read(${lssqdlist.id},${lssqdlist.sqlx})"><font color="red">查 看 </font> </a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="2"> <a href="#" mce_href="#" onclick="read(${lssqdlist.id},${lssqdlist.sqlx})"> <font color="red">查 看 </font></a> </logic:equal> <logic:equal name="lssqdlist" property="ztflag" value="4"> <a href="#" mce_href="#" onclick="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的填写。

不能乱写。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值