1

Can you please help with this issue. Find the fiddle code here:

jsfiddle.net/srikanthsvr82/mZc7V/4

What is happening is when I'am dragging a row the dragged row is in full width and looks good but the other rows shrink/column width reduces. I have been trying all options as u can see in the commented code but none is working:

/*
start: function(event, ui){
  ui.placeholder.width(ui.item.width()).height(ui.item.height());
},
helper: function(e, tr){
  tr.children().each(function() {
    $(this).width($(this).width());
  });
  return tr;
  $("td").each(function () {
    $(this).css("width", $(this).width());
  });
  var $originals = tr.children();
  var $helper = tr.clone();
  $(tr.parent()).find('tr').each(function(index){
    $('td', this).each(function(index){
      $(this).css('width', $helper.eq(index).width());
    });
  });
  $helper.children().each(function(index){
    //Set helper cell sizes to match the original sizes
    $(this).width($originals.eq(index).width());
  });
  return $helper;
}
*/

Can anyone please suggest the solution.

Jabel Márquez
  • 772
  • 1
  • 11
  • 38
user3496151
  • 181
  • 1
  • 13
  • possible duplicate of [jquery ui sortable table-layout fixed issue - rows shrink while dragging (9185 bug)](http://stackoverflow.com/questions/22876081/jquery-ui-sortable-table-layout-fixed-issue-rows-shrink-while-dragging-9185-b) – T J Jun 30 '14 at 13:04

1 Answers1

0

I can't claim to fully understand how this plugin works, but the following alteration to the "helper" parameter fixes the problem:

        helper: function(e, tr)
        {
            var myHelper = [];
            myHelper.push('<div style="width:10px;"><table>');
            myHelper.push($(tr).html());
            myHelper.push('</table></div>');                    
            return myHelper.join('');                   
        },

Basically, wrap the helper in a container of the same width as the first column of the table.

Dave
  • 4,375
  • 3
  • 24
  • 30
  • thanks for the reply, actually am facing the same issue as present in the below jquery bug .. http://bugs.jqueryui.com/ticket/9185. we have the table-layout as fixed and hence while dragging other rows widths are shrinking and we cannot change the table-layout to auto so please help me with the code on how we can solve this jquery bug. – user3496151 Apr 05 '14 at 02:55