jQuery ui sortable tablerows refresh number position inside

后端 未结 2 796
悲哀的现实
悲哀的现实 2021-02-05 15:01

In a html table I have in every row a cell with its own position number. How can I refresh this position number correctly after sorting with jQueryUI?

This is my simple

2条回答
  •  一生所求
    2021-02-05 15:57

    If anybody liked the above answer as I did, here's the Coffeescript

    jQuery ->
      $("ul.sortableEdit").sortable
                stop: (event, ui) ->  
                 $('ul.sortableEdit li').each( ->
                   $(this).children('input.sortableItemPos').val($(this).index())
                 )
    

提交回复
热议问题