项目需要实现表格拖动排序功能,直接贴代码~~~
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery-tableDnD</title>
<script type="text/javascript" src="tablednd.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.tablednd_0_5.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#actionItems").tableDnD({
onDrop:function(table,row) {
INDEX = 0;
$(".sequence").each(function() {
if($(this).text() != ++INDEX) {
$(this).html(INDEX);
}
});
}
});
});
</script>
<style type="text/css">
TABLE TD {
border-bottom: #c3d3e3 solid 1px;
border-left: #c3d3e3 solid 1px;
border-right: solid #c3d3e3 1px;
border-top: #c3d3e3 solid 1px;
}
TABLE TH {
border-bottom: #c3d3e3 solid 1px;
border-left: #c3d3e3 solid 1px;
border-right: solid #c3d3e3 1px;
border-top: #c3d3e3 solid 1px;
background-color: #e9f0f7;
height: 30px;
}
</style>
</head>
<body>
<table id="actionItems" style="border-collapse: collapse;">
<thead>
<tr>
<th style="cursor: default;">
<div>ID</div>
</th>
<th style="cursor: default;">
<div>Name</div>
</th>
<th style="cursor: default;">
<div>Status</div>
</th>
<th style="cursor: default;">
<div>Project</div>
</th>
<th style="cursor: default;">
<div>Date</div>
</th>
</tr>
</thead>
<tbody id="sortable">
<tr>
<td class="sequence">1</td>
<td><a id="toActionItemDetail" href="#">prototype</a></td>
<td>New</td>
<td>Em6.0</td>
<td>2012-09-10</td>
</tr>
<tr>
<td class="sequence">2</td>
<td><a id="toActionItemDetail" href="#">Action</a></td>
<td>Open</td>
<td>prvo</td>
<td>2012-09-23</td>
</tr>
<tr>
<td class="sequence">3</td>
<td><a id="toActionItemDetail" href="#">Item</a></td>
<td>Closed</td>
<td>Em2.0</td>
<td>2011-07-10</td>
</tr>
</tbody>
</table>
</body>
</html>
附件附需要的js文件
分享到:
相关推荐
jquery.tablednd_0_5.js
之前项目有一个简单需求就是实现表格行的上下拖动,当时搜了这个插件,挺好用的,现在分享给大家。
PHP+jQuery+html5实现图片选取裁剪上传(兼容手机上传)
jQuery_CHM_1.4.4.chm+jquery1.6jQuery_CHM_1.4.4.chm+jquery1.6jQuery_CHM_1.4.4.chm+jquery1.6jQuery_CHM_1.4.4.chm+jquery1.6jQuery_CHM_1.4.4.chm+jquery1.6jQuery_CHM_1.4.4.chm+jquery1.6jQuery_CHM_1.4.4.chm...
PHP+jQuery实现翻板抽奖 特效源码
jquery.tablednd.js 用于table拖动 ;添加 $("#tablename").tableDnD();初始化
jquery +jquery.tablesorter+jquery.tablednd_0_5实现table表格可按行拖拽,按列排序,并可以保存排序后的结果
jquery+jquery.tablednd_0_5.js+jquery.tablesorter.js实现表格排序和拖拽行,可以按照列的条件先排序,然后再拖动行进行排序。
JQuery1.7.1API+jquery1.7.1.min.js+air打开工具
jQuery Validate 插件为表单提供了强大的验证功能,让客户端表单验证变得更简单,同时提供了大量的定制选项,满足应用程序各种需求。该插件捆绑了一套有用的验证方法,包括 URL 和电子邮件验证,同时提供了一个用来...
jquery 模拟人工拖拽轨迹,生成轨迹数据
ajax,jquery,json一个页面实现Ajax效果的增删改查-JQuery+Json版.zip
jquery提供的json插件,提供js对象与json字符串间互相转换
jquery1.7下载,和参考手册,就是学习jquery的官方API和js文件,1.7版本的,剩余是凑字数的
jquery.modaldialog.1.0.0.zip_JQuery模式窗体例子
jQuery 是一个 JavaScript 库。jQuery 极大地简化了 JavaScript 编程。jQuery 很容易学习。
使用jQuery实现的网页笔记本翻页效果,可以直接插入网页代码使用
bootstrap-table实现 行拖拽 插件 jquery.tablednd.js bootstrap-table-reorder-rows.js bootstrap-table-reorder-rows.css
bootstrapTable jquery.tablednd行拖动调整资源
jQuery+JavaScript+ajax手册.rar:jQuery JavaScript ajax 手册