Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#4325 closed bug (notabug)

sortable fires sortupdate-event twice

Reported by: MMore Owned by:
Priority: minor Milestone:
Component: ui.sortable Version: 1.7
Keywords: sortupdate encapsulated list Cc: mathias.nestler@…
Blocked by: Blocking:


When you have an unordered encapsulated list. And you want to sort two parts of it. When you sort the nested node the sortupdate-event fires twice.

For instance you have such a list:

<ul id="menulist">
<li id="mainmenu_1" class="mainmenuitem">Start
	<ul class="submenulist">
		<li id="submenu_9">Home</li>
		<li id="submenu_7">Homer</li>
		<li id="submenu_6">Homest</li>
<li id="mainmenu_2" class="mainmenuitem">Foobar
	<ul class="submenulist">
		<li id="submenu_5">Host</li>
		<li id="submenu_4">Hoster</li>

"Start" and "Foobar" is the first part. In their nested nodes is the second part of the encapsulated list.

And this jquery code:

$(\"#menulist:not(.submenulist)\").sortable({ items: 'li.mainmenuitem' });

	var order = $(this).sortable('serialize');

	var order = $(this).sortable('serialize');

For example, when you sort "hoster" above "host" the sortupdate-event of .submenulist and #menulist:not(.submenulist) are fired.

Is it a bug or feature? Or a false approach?

Change History (3)

comment:1 Changed 11 years ago by jakeisonline

This isn't a bug, it's supposed to call them both because both of the lists have been updated, hence the callback name of "update".

If you want it to just trigger once, best used "receive" event callback.

comment:2 Changed 11 years ago by Jörn Zaefferer

Resolution: invalid
Status: newclosed

See comment by jakeisonline.

comment:3 Changed 8 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.