just fixed a 3-hour bug with jQuery NestedSortable – had to allocate a (spurious) ID to each element in the list

25 Sep

Symptoms were:

– When I add an “onchange” handler, it gives the error, “syntax error:
unrecognized expression #”
– In TiddlyWiki (but not in a standalone app), dropping the element
after a drag operation, it goes to the bottom of the page.

Googling the first error didn’t show much other than legacy selector issues.

Solution was to allocate unique IDs to each element using a counter
and ++’ing it each time. You’ll see it when I next check in the
nascent TiddlyWiki Trails plugin, which is based on the TiddlyDocs
tree.

I found it by biting the bullet and grabbing all the source. The main distro
http://bernardopadua.com/nestedSortables/test/nested_sortable/ just
provides a packed version of the dependencies in the interface lib.

It might be useful for anyone debugging this component to have the
dependencies in original source form. Here they are:

https://gist.github.com/193772

All this is legacy btw; you’d nowadays expect to use JQuery UI tree
component with dependencies in JQuery UI; but Tree, which is to be
based on the NestedSortable I cover here, is still not official. We
used NestedSortable in TiddlyDocs, so I’m using it here; and hopefully
we’ll be able to replace TiddlyDocs’ menu with this generic component.

Great! The component now reads a trail spec from a tiddler and lets
you drag around items, with links to open up the tiddlers. TiddlyWiki
trail component is well on its way!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: