开发者

jQuery UI sortable({ stop:function(){} }) causing error - this.helper is null

first I have a sortable container with class="viewport", then I want show each child's id after be sorted, so the code:

$(".v开发者_JAVA技巧iewport").sortable({
                    connectWith: '.viewport',
                    revert: true,
                    stop: function () {
                            $sort_left_array=$(this).children();
                            $sort_left_arry.each(function(){
                                alert($(this).attr("id"));
                            });
                    }
                });

but after sorted, in firebug, it alerts "this.helper is null", the alert function doesn't work, also the page's all animate don't work.

by the way the items in sortable container is loaded with ajax when the page is loading,in the $(function(){}) part at the head of the page, does that matter?

Has anyone had this problem before? How can I solve this problem?


There is a typo in the code in your question:

$sort_left_array=$(this).children();
$sort_left_arry.each(function(){
    alert($(this).attr("id"));
});

$sort_left_array != $sort_left_arry. Also, unless you've declared var $sort_left_array somewhere else in your code, you're missing a var keywork in the stop callback.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜