jquery UI Sortable with table and tr width

前端 未结 12 797
不知归路
不知归路 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 18:42

    I found the answer here.

    I modified it slightly to clone the row, instead of adding widths to the original:

      helper: function(e, tr)
      {
        var $originals = tr.children();
        var $helper = tr.clone();
        $helper.children().each(function(index)
        {
          // Set helper cell sizes to match the original sizes
          $(this).width($originals.eq(index).width());
        });
        return $helper;
      },
    

提交回复
热议问题