最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery Sortable callbacks not working? - Stack Overflow

programmeradmin3浏览0评论

I'm using the Sortable ponent of jQuery UI. The callbacks don't seem to work at all, even with this minimalistic test:

<script type="text/javascript" src="jquery-1.3.js"></script>
<script type="text/javascript" src="jquery-ui-personalized-1.6rc4.js"></script>
<script type="text/javascript">
$(document).ready(function () {
    $("#outer").sortable({
        start: function (e, ui) {
            alert("started");
        },
        update: function (e, ui) {
            alert("updated");
        }
    });
});
</script>
<ul id="outer">
<li>apple</li>
<li>orange</li>
</ul>

I get none of the alerts when I reorder these elements.

Is my usage correct or am I perhaps misreading the documentation?

start Function(Event, ui)

Function that gets called when sorting starts.

I'm using the Sortable ponent of jQuery UI. The callbacks don't seem to work at all, even with this minimalistic test:

<script type="text/javascript" src="jquery-1.3.js"></script>
<script type="text/javascript" src="jquery-ui-personalized-1.6rc4.js"></script>
<script type="text/javascript">
$(document).ready(function () {
    $("#outer").sortable({
        start: function (e, ui) {
            alert("started");
        },
        update: function (e, ui) {
            alert("updated");
        }
    });
});
</script>
<ul id="outer">
<li>apple</li>
<li>orange</li>
</ul>

I get none of the alerts when I reorder these elements.

Is my usage correct or am I perhaps misreading the documentation?

start Function(Event, ui)

Function that gets called when sorting starts.

Share edited Jan 21, 2009 at 19:08 Ateş Göral asked Jan 21, 2009 at 18:42 Ateş GöralAteş Göral 140k27 gold badges141 silver badges191 bronze badges 2
  • What does firebug (or your preferred javascript debugger) say? I got it working with jQuery 1.3 and the current jQuery UI (personalized: core, draggable, sortable), version 1.6rc5. – Tomalak Commented Jan 21, 2009 at 19:08
  • I'm on Firefox and I get absolutely no errors/warnings. It's just dead silent. However, sorting works as expected. It's just the callbacks that don't seem to work. I'm trying to avoid digging into jQuery UI code :( – Ateş Göral Commented Jan 21, 2009 at 19:14
Add a ment  | 

2 Answers 2

Reset to default 2

It seems that the .sortable() is having some technical difficulties according to this post. You may need to use SVN to download the latest trunk release to fix it.

I was able to work around this problem by including two versions of jquery simultaneously. Check it out here: http://gist.github./59757

Hope it helps!

发布评论

评论列表(0)

  1. 暂无评论