ui.sortable.js - 1.6rc2 - Missing Logic in: toArray

24 views
Skip to first unread message

JoeFlash

unread,
Oct 2, 2008, 12:43:41 PM10/2/08
to jQuery UI Development
While implementing sortable lists I encountered errors when calling
'toArray'. These errors were not experienced when calling the
comparable functionality 'serialize' and I noticed a difference in the
object testing logic. Below is my correction to the logic to have the
same object testing for both 'toArray' and 'serialize' and it has
corrected the errors I experienced.

toArray: function(o) {
var items = this._getItemsAsjQuery(o && o.connected);
var ret = []; o = o || {};
items.each(function() { ret.push($(this.item ||
this).attr(o.attribute || 'id') || ''); });
return ret;
},

Paul Bakaus

unread,
Oct 4, 2008, 2:28:12 AM10/4/08
to jquery...@googlegroups.com
Good find, will fix this one on my next commit!
Anyway, I wonder why we had this.items in there anyway...I guess it should have been
o.items in both functions.

Sebastian Tänzer (amcm web)

unread,
Nov 4, 2008, 4:06:21 PM11/4/08
to jQuery UI Development
For others having the same problem:
This has not been fixed in 1.6rc2 online yet.
I had to use Joe's code fix.

Paul Bakaus schrieb:

Gauthier Segay

unread,
Nov 17, 2008, 9:41:00 AM11/17/08
to jQuery UI Development
Thanks, that's fixing an issue I got!

However please note that an empty element have appeared in the
returned array, which was not present with 1.5.2 AFAIK.

doutu

unread,
Jan 5, 2009, 10:40:58 AM1/5/09
to jQuery UI Development
It does not work in ui 1.6rc4


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-nightly.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<style type="text/css" media="screen">
ul { list-style: none; }
li { background: #727EA3; color: #FFF; width: 100px; margin: 5px; font-
size: 10px; font-family: Arial; padding: 3px; }
</style>
</head>
<body>
<ul id="myList">
<li id='i_1'>Item 1</li>
<li id='i_2'>Item 2</li>
<li id='i_3'>Item 3</li>
<li id='i_4'>Item 4</li>
</ul>
<script type="text/javascript">
var result = $("#myList").sortable("serialize");
alert(result); // undefined
for(var v=0, len=result.length; v<len;)
{
alert(result[v]);
}
</script>
</body>
</html>



On Nov 17 2008, 10:41 pm, Gauthier Segay <gauthier.se...@gmail.com>
wrote:

Richard D. Worth

unread,
Jan 5, 2009, 10:47:06 AM1/5/09
to jquery...@googlegroups.com
Could you enter a ticket for this?

http://ui.jquery.com/bugs/newticket (note: requires registration)

Thanks.

- Richard
Reply all
Reply to author
Forward
0 new messages