我有一些困難與可排序的選項句柄。jQuery UI可排序表句柄
當我使用:
$("table tr").sortable().disableSelection();
是沒有問題的。
如果我添加了手柄選項,則排序停止工作:
$("table tr").sortable({
handle: "td:eq(0)"
}).disableSelection();
鏈接:
誰能幫助我嗎?
我有一些困難與可排序的選項句柄。jQuery UI可排序表句柄
當我使用:
$("table tr").sortable().disableSelection();
是沒有問題的。
如果我添加了手柄選項,則排序停止工作:
$("table tr").sortable({
handle: "td:eq(0)"
}).disableSelection();
鏈接:
誰能幫助我嗎?
包裝你<tr>
的在<tbody>
和你的代碼更改爲:
$("table tbody").sortable({
handle: 'td:first'
}).disableSelection();
您指定包含要爲可排序而不是實際的元素元素的容器......
嘗試傳遞一個元素:http://jsfiddle.net/22C2n/5/
$("table tr").sortable({
handle: $("td:eq(0)")
}).disableSelection();
手柄設置爲td:eq(0)
使得僅所述第一表細胞可排序,其餘的細胞都不是。嘗試在td
內添加span
,並將其用作手柄(demo)。
HTML
<table>
<tr>
<td><span>•</span>1A</td>
<td>1B</td>
<td>1C</td>
</tr>
...
</table>
腳本
$("table tr").sortable({
handle: "span"
}).disableSelection();
完美!!!!它從表'FIRST'列開始排序,因此您可以輕鬆選擇列文本。不要忘記刪除.disableSelection()選項。 – 2016-06-17 21:56:31