我有以下代码将jQuery UI可排序插件应用于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();
Run Code Online (Sandbox Code Playgroud)
但是,如果有多行(除了标题行),我只想对表进行排序,否则拖放功能是多余的.
如何有条件地将上述内容仅应用于具有多个内容行的表?谢谢.