jquery UI Sortable with table and tr width

前端 未结 12 803
不知归路
不知归路 2020-11-28 18:02

I am using jQuery UI sortable to make my table grid sortable. The code seems to work fine but because I am not adding width to tds, when I drag the tr

12条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 19:03

    $(function() {
        $( "#sort tbody" ).sortable({
            update: function () {
                                    var order = $(this).sortable("toArray").join();
                                    $.cookie("sortableOrder", order);
                            }
        });
        if($.cookie("sortableOrder")){
            var order = $.cookie("sortableOrder").split(",");
            reorder(order, $("#sort tbody"));
        }
        function reorder(aryOrder, element){
          $.each(aryOrder, function(key, val){
                  element.append($("#"+val));
          });
        }
      });
    

提交回复
热议问题