First a patch is needed http://dev.rubyonrails.org/ticket/7396
That tenery operator wont work in that situation.... you need to evaluate
the return of the function
onUpdate : function (el) {
// do your code
}
revert : changeClass // function call
And you change class must provide a boolean true or false.....
function changeClass(el,o,n) {
return (Element.hasClassName( el, n.id)) ? true : false;
}
This should do the trick for you
HTH
ALex
----- Original Message -----
From: "terry-5-" <[email protected]>
To: "Prototype & script.aculo.us" <[email protected]>
Sent: Monday, June 01, 2009 2:58 PM
Subject: [Proto-Scripty] Revert sortable on return value true? Possible?
>
> Hi,
>
> I really appreciate all you guys hard work. It has helped me in the
> past very much and I really hope someone has encountered this problem
> before. I tried to find a related one in this group, but had no luck.
>
> I am trying to revert the sortable/draggable to its original place if
> the changeClass function returns true.
> I have problems to get a return value after an onUpdate function has
> been succesful executed.
>
> This is the original Sortable decleration:
>
> Sortable.create('blank_1',{tag:'span',dropOnEmpty: true,
> constraint:true, containment:sections, only:'lineitem',
> onUpdate:function(el){changeClass(el);}});
>
>
> And this is how I tried to check for the return value. :
>
> Sortable.create('blank_1',{tag:'span',dropOnEmpty: true,
> constraint:true, containment:sections, only:'lineitem',
> onUpdate:function(el){changeClass(el);}?'lineitem'.revert:function(el)
> {NoChange(el)};});
>
> I am not sure how to reference the 'lineitem', if revert even is a
> function of sortable object/class (it is not part of the
> documentation), if I have to create a seperate Draggable to revert it,
> or if I can have a conditional statement like the above.
>
> My website is almost finished and only needs this little detail.
>
> Many thanks again.
>
>
> Nathalie
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---