The later releases of MS Ajax are actually compatible with Prototype
(for instance, the $() function has been renamed to $get() so that
users can have both libraries running together).
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!
On Jan 22, 8:11 pm, "Malard"
<mal...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> What is the error you are getting. Also the MS Ajax "Atlas"
library is
> probably incompatiable with the prototype.js library. Your mixing
> frameworks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---