我是jquery的新手,我也不是一个程序员。 我试过在谷歌搜索答案,但我找不到答案。
我已经创建了一个表并在列中应用了排序,但我不想让几列可排序,其类名为“.canvas-head”。 这就是我想要的:
<script>
$(function () {
$('#sorting').sorttable({
placeholder: 'placeholder',
helperCells: ':not(.footerrow td)'
}).disableSelection();
function reset(){
$(".canvas-head").sorttable('disable');
}
$('.canvas-head').bind('click',reset);
});
</script>
<table id="sorting">
<tbody>
<tr class="headerrow ui-sortable">
<th class="ui-resizable tac"><div class="ui-resizable">First Year Corn <br>Non Limited N, High Pop(1)</div></th>
<th class="canvas-head">Canvas</th>
<th class="ui-resizable tac"><div class="ui-resizable">First Year Corn <br>Non Limited N, High Pop(2)</div></th>
</tr>
<tr>
<td>one</td>
<td>Two</td>
<td>three</td>
</tr>
</tbody>
</table>
答案 0 :(得分:1)
答案 1 :(得分:0)
您可以为您不想应用sortable
的某些表列提供类或 ID ,而不是.not
在选择中
对于Eg:
$(function() {
$('#list').sortable({items: '> li:not(.pin)'});
});
<ul id="list">
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li class="pin">Five</li>
</ul>