Is it going to be the case that I need to break out a Javascript
debugger and find out where the incompatability is, or are there any
known issues?
P.S. This is using MS Ajax RC1 and Scriptaculous 1.7.
I tracked down the problem to the fact that Javascript rendered inline
within an UpdatePanel is not executed, so where I was creating my
Sortable, that code wasn't being executed. After a lot of faffing
around, I moved the code outside of the UpdatePanel, and added an event
handler for the endRequest event, which is triggered after an MS Ajax
call has finished, something like this:
<script type="text/javascript">
// <![CDATA[
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandle);
function endRequestHandle(sender, args)
{
if (args.get_error() == null)
{
if ($("photoframe"))
{
Sortable.create("photoframe",
{
tag:'div',only:'photoimage',overlap:'horizontal',constraint:false,
onUpdate:function()
{
$("<%= SortOrderHiddenFieldID %>").value =
Sortable.serialize("photoframe");
}
});
}
}
}
// ]]>
</script>
(usually you handle this event so you can do some pretty error
handling, but it also works for me when using Scriptaculous). So when
the UpdatePanel had finished doing its Ajaxy trickery, I could then
bind the Scriptaculous Sortable to the "photoframe" div element if it
existed. From then on, it was all plain sailing (apart from having to
get a reference to the hidden field that I dumped the contents of
Sortable.serialize() into).
I've been *really* impressed by how easily Scriptaculous worked once
I'd got around this MS Ajax stumbling block. My colleagues are also
well impressed by how nice the Sortable stuff looks and works. I'd been
playing with the MS Ajax Control Toolkit and its ReorderList, and it
just wouldn't work. Scriptaculous? A handful of lines of Javascript,
and gorgeous drag-n'droppery of photos. So major kudos to the
Scriptaculous team for putting together something so useful!