JQuery sortable lists and fixed/locked items

前端 未结 9 1572
故里飘歌
故里飘歌 2020-11-28 06:07

Is it possible to lock list items in JQuery sortable list in a way that those items will stay in that particular place in the list.

For example,

consider th

9条回答
  •  死守一世寂寞
    2020-11-28 07:01

    Using the items parameter you can achieve what you want like this:

    $("#mytable tbody").sortable({items: 'tr.sortable'});
    

    Only rows with a .sortable CSS class can be sorted now.

    If you want to lock only the 1st row you can do this:

    $("#mytable tbody").sortable({items: 'tr:not(:first)'});
    

    The possibilities are endless...

提交回复
热议问题