开发者

Want to Drag and Drop Table loaded in Ajax into a Tab

开发者 https://www.devze.com 2023-02-04 15:31 出处:网络
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,

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();
        });
0

精彩评论

暂无评论...
验证码 换一张
取 消