On my Index.html page, many tabs. Into some of them, I load a table (grid) from an .asp file. It works fine. I want that table to be "drag and dropable". The .asp file works fine when run by itself, but doesn't into the tab. I make a sample .html file with a drag and dropable table (exact same structure as the result table of the asp file), it works... Why? :-)
Here is part of the code :
the html :
<table id="sort" class="grid" title="tout a moi" border="1">
the jQuery :
$(document).ready(function(){
$("#sort tbody").sortable().disableSelection();
})
I remember once reading a solution somewhere 开发者_C百科but don't seem to find it again.
I was missing the helper. Like this, it works fine:
$(document).ready(function(){
var fixHelper = function(e, ui) {
ui.children().each(function() {
$(this).width($(this).width());
});
return ui;
};
$("#sort tbody").sortable({
helper: fixHelper
}).disableSelection();
});
精彩评论