我有以下代码,将jQuery UI Sortable插件应用于ASP.NET页面上的所有表格(GridView),但不包括每个表格的第一行(标题):
function pageLoad() {
$('table').sortable({
items: 'tr:not(:first)',
axis: 'y',
scroll: true,
start: startDrag, //store start position
stop: stopDrag //get end position, update database
}).disableSelection();
如果表格中只有一个内容行(除了标题行),则拖放功能是多余的,因此我只想将sortable应用于具有多个行的表格。
如何仅对具有多个内容行的表格进行上述条件性应用?谢谢。
index()
,或使用sortable.serialize()
导出完整的位置状态:http://jqueryui.com/demos/sortable/#method-serialize - James McCormack