Knockout with jQuery UI Sortable

3,007 views
Skip to first unread message

Stacey Thornton

unread,
Nov 11, 2010, 1:53:06 PM11/11/10
to KnockoutJS
Posting this as its own topic, since it's not really the question by
the original author of the jQuery UI topic.

http://www.pastie.org/1285716

Trying to get custom bindings to work with jQuery UI sortable, but I'm
having difficulty because it is not really getting the data when
something is dropped, I just get a "true/false" value returned.

Stacey Thornton

unread,
Nov 15, 2010, 9:49:27 AM11/15/10
to KnockoutJS
Hello, I was wondering, Steve, if you had any chance to take a look at
this. I've been trying over the past few days and am still hitting a
dead end on trying to get this to work.

Steven Sanderson

unread,
Nov 16, 2010, 4:01:00 AM11/16/10
to knockoutjs
Hi

Sorry, I haven't been able to spend time on this yet - there's a lot of other stuff going on right now. It's still on the list, but may be a while!

Regards
Steve
Message has been deleted

Stacey Thornton

unread,
Nov 16, 2010, 9:21:13 AM11/16/10
to KnockoutJS
I understand! Thank you for looking at it. I know you must be
extremely busy. I will wait patiently until you have the chance.

On Nov 16, 3:01 am, Steven Sanderson <ste...@stevensanderson.com>
wrote:
> Hi
>
> Sorry, I haven't been able to spend time on this yet - there's a lot of
> other stuff going on right now. It's still on the list, but may be a while!
>
> Regards
> Steve
>

Taylor Yelverton

unread,
Dec 27, 2010, 10:02:41 PM12/27/10
to knock...@googlegroups.com
Has any progress been made on this?

fla...@gmail.com

unread,
Dec 29, 2010, 7:17:35 AM12/29/10
to KnockoutJS
Hi

There's no real difficulty with doing this - you just need to add some
kind of unique ID to the model items so that you can match up the DOM
elements that jQuery UI gives you back to the original model items.
Once you've got those IDs, just move the corresponding objects around
in the view model.

Here's a working example: https://gist.github.com/758467

Regards
Steve

Stacey Thornton

unread,
Jan 6, 2011, 9:02:17 AM1/6/11
to KnockoutJS
Hey, Steve.

I am sorry I did not reply sooner - Google Groups Never Alerted me
that this had been responded to, and with my workload increasing
exponentially, it kind of slipped my mind to re-check on it, so I
assumed it had fallen by the wayside.

Thank you for clearing this up. This is extremely useful and I think
it would be really cool to show this example in the KO Documentation.
More people need to see how to integrate jQuery UI into KO. I think
there is a high demand for it, and from one programmer to another, I
will be brutally (and somewhat rudely) honest when I say that the
documentation on the binding is just not verbose enough to really
explain it all. You have a killer suite here, and the more I learn
about it, the more I see that it is going to become as big as jQuery
itself someday.

On Dec 29 2010, 6:17 am, "st...@codeville.net" <fla...@gmail.com>
wrote:

david.s...@gmail.com

unread,
Jul 21, 2011, 5:35:24 PM7/21/11
to knock...@googlegroups.com
Here is a working example http://jsbin.com/knockoutsortable/edit.

Josh Rivers

unread,
Jul 22, 2011, 12:09:04 AM7/22/11
to knock...@googlegroups.com
It's not actually sortable, though. Right?

rpn

unread,
Jul 22, 2011, 12:16:58 AM7/22/11
to knock...@googlegroups.com
Just wanted to add to this thread.  I had a post on this a while back with my attempts at this: http://www.knockmeout.net/2011/05/dragging-dropping-and-sorting-with.html

It includes a sample for connecting an observableArray to a sortable list and a sample for drag and dropping items between two observableArrays.  In case it helps anyone that stumbles on this thread.

Also, Ivan Zlatev shared a similar binding recently here: https://groups.google.com/d/topic/knockoutjs/Fto0w4bCkxM/discussion
 

David Sullivan

unread,
Jul 22, 2011, 5:43:26 PM7/22/11
to knock...@googlegroups.com
Thanks for this. Zlatev's example was exactly what I was looking for. And I am still reading every one of your blog posts. 
Reply all
Reply to author
Forward
0 new messages