[Proto-Scripty] Re: Revert sortable on return value true? Possible?
I am a bit desperate now. I have tried to work this over and over to the point where I think I have to give up. I tried 2 different revert declarations: 1. revert:changeClass Sortable.create('blank_1',{tag:'span',dropOnEmpty: true, constraint:true, containment:sections, only:'lineitem',revert:changeClass}); 2. revert:true (so it should always execute - I would think) Sortable.create('blank_1',{tag:'span',dropOnEmpty: true, constraint:true, containment:sections, only:'lineitem',revert:true}); Also to make sure that this isn't my functions mistake, I set the return statement of my changeClass function to true. Meaning that revert will be set to true and should be executed every single time the object is dragged. Here is the very simplified function function changeClass(el){ return true;} Leaves me to think that the patch does not work. I tried again firebug debugging: Set breakpoints for the patches revert seems never to be set? Can anyone help me?? --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
I just figured out that if I remove the event 'Update:+function call' changeClass is never executed during 'revert:changeClass'. I planted an alert statetement right before the function return statement to see what value is being returned and it doesn't execute if 'Update' is removed. So is it the revert event that is not working? Sortable.create('blank_1',{tag:'span',dropOnEmpty: true, constraint:true, containment:sections, only:'lineitem', revert:changeClass}); doesn't call changeClass function/ nothing is returned Sortable.create('blank_1',{tag:'span',dropOnEmpty: true, constraint:true, containment:sections, only:'lineitem', revert:changeClass, onUpdate:function(el){changeClass(el)}}); calles changeClass function/returns false or true. --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
I would have to say its an error in your function but i cant see where at the moment... i will deeper investigate when i've finished what i am doing Alex - Original Message - From: "terry-5-" To: "Prototype & script.aculo.us" Sent: Wednesday, June 03, 2009 3:23 PM Subject: [Proto-Scripty] Re: Revert sortable on return value true? Possible? > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1921, Column: 39 > Source Code: > if (match = source.match(pattern)) { > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 285, Column: 60 > Source Code: > if (result = !!(iterator || Prototype.K)(value, index)) > > . (left some out here) > > Warning: variable methods redeclares argument > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1121, Column: 8 > Source Code: >var methods = Element.Methods, cache = Element.extend.cache; > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1290, Column: 66 > Source Code: >while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { > > . (left some out here) > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1500, Column: 17 > Source Code: > }).join('&'); > > Warning: variable element redeclares argument > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1757, Column: 8 > Source Code: >var element = $(element); > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1885, Column: 27 > Source Code: > }, > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1916, Column: 41 > Source Code: >} while (element = element.parentNode); > > Warning: assignment to undeclared variable ObjectRange > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 553 > > Warning: redeclaration of property clone > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1921 > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/builder.js > Line: 73, Column: 12 > Source Code: > return element; > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/effects.js > Line: 50, Column: 52 > Source Code: > if (opacity = Element.getStyle(element, 'opacity')) > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/effects.js > Line: 52, Column: 90 > Source Code: > if (opacity = (Element.getStyle(element, 'filter') || '').match(/ > alpha\(opacity=(.*)\)/)) > > Warning: reference to undefined property o[eventName] > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/dragdrop.js > Line: 198` > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/dragdrop.js > Line: 540, Column: 40 > Source Code: >return Sortable.sortables[element.id]; > > Warning: function gettrailobjnostyle does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/searchover.js > Line: 29, Column: 20 > Source Code: > } > > > --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
They are two, and this is just a place where Lint and Prototype disagree. This could be written as if((match = source.match(pattern))) { ... and Lint would say "Sure! That's just fine! " because that's like saying if (true){ But Prototype house style is about less typing (in the keyboard sense of the word) and this assignment-which-returns- either-false-or-something-truthy will actually **work** in JavaScript. Walter On Jun 3, 2009, at 11:11 AM, Alex McAuley wrote: > > sorry i cant read the = signs ... are they 3 equals ( = = =) or 2 (= > =) - > obviously without spaces !! > > > - Original Message - > From: "terry-5-" > To: "Prototype & script.aculo.us" > > Sent: Wednesday, June 03, 2009 3:23 PM > Subject: [Proto-Scripty] Re: Revert sortable on return value true? > Possible? > > >> >> Warning: test for equality (==) mistyped as assignment (=)? >> Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js >> Line: 1921, Column: 39 >> Source Code: >> if (match = source.match(pattern)) { >> >> Warning: test for equality (==) mistyped as assignment (=)? >> Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js >> Line: 285, Column: 60 >> Source Code: >> if (result = !!(iterator || Prototype.K)(value, index)) >> >> . (left some out here) --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
sorry i cant read the = signs ... are they 3 equals ( = = =) or 2 (= =) - obviously without spaces !! - Original Message - From: "terry-5-" To: "Prototype & script.aculo.us" Sent: Wednesday, June 03, 2009 3:23 PM Subject: [Proto-Scripty] Re: Revert sortable on return value true? Possible? > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1921, Column: 39 > Source Code: > if (match = source.match(pattern)) { > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 285, Column: 60 > Source Code: > if (result = !!(iterator || Prototype.K)(value, index)) > > . (left some out here) > > Warning: variable methods redeclares argument > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1121, Column: 8 > Source Code: >var methods = Element.Methods, cache = Element.extend.cache; > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1290, Column: 66 > Source Code: >while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { > > . (left some out here) > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1500, Column: 17 > Source Code: > }).join('&'); > > Warning: variable element redeclares argument > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1757, Column: 8 > Source Code: >var element = $(element); > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1885, Column: 27 > Source Code: > }, > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1916, Column: 41 > Source Code: >} while (element = element.parentNode); > > Warning: assignment to undeclared variable ObjectRange > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 553 > > Warning: redeclaration of property clone > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js > Line: 1921 > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/builder.js > Line: 73, Column: 12 > Source Code: > return element; > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/effects.js > Line: 50, Column: 52 > Source Code: > if (opacity = Element.getStyle(element, 'opacity')) > > Warning: test for equality (==) mistyped as assignment (=)? > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/effects.js > Line: 52, Column: 90 > Source Code: > if (opacity = (Element.getStyle(element, 'filter') || '').match(/ > alpha\(opacity=(.*)\)/)) > > Warning: reference to undefined property o[eventName] > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/dragdrop.js > Line: 198` > > Warning: anonymous function does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/dragdrop.js > Line: 540, Column: 40 > Source Code: >return Sortable.sortables[element.id]; > > Warning: function gettrailobjnostyle does not always return a value > Source File: http://tltc.la.utexas.edu/rr/js/searchover.js > Line: 29, Column: 20 > Source Code: > } > > > --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
Warning: test for equality (==) mistyped as assignment (=)? Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1921, Column: 39 Source Code: if (match = source.match(pattern)) { Warning: test for equality (==) mistyped as assignment (=)? Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 285, Column: 60 Source Code: if (result = !!(iterator || Prototype.K)(value, index)) . (left some out here) Warning: variable methods redeclares argument Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1121, Column: 8 Source Code: var methods = Element.Methods, cache = Element.extend.cache; Warning: test for equality (==) mistyped as assignment (=)? Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1290, Column: 66 Source Code: while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { . (left some out here) Warning: anonymous function does not always return a value Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1500, Column: 17 Source Code: }).join('&'); Warning: variable element redeclares argument Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1757, Column: 8 Source Code: var element = $(element); Warning: anonymous function does not always return a value Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1885, Column: 27 Source Code: }, Warning: test for equality (==) mistyped as assignment (=)? Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1916, Column: 41 Source Code: } while (element = element.parentNode); Warning: assignment to undeclared variable ObjectRange Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 553 Warning: redeclaration of property clone Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/prototype.js Line: 1921 Warning: anonymous function does not always return a value Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/builder.js Line: 73, Column: 12 Source Code: return element; Warning: test for equality (==) mistyped as assignment (=)? Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/effects.js Line: 50, Column: 52 Source Code: if (opacity = Element.getStyle(element, 'opacity')) Warning: test for equality (==) mistyped as assignment (=)? Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/effects.js Line: 52, Column: 90 Source Code: if (opacity = (Element.getStyle(element, 'filter') || '').match(/ alpha\(opacity=(.*)\)/)) Warning: reference to undefined property o[eventName] Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/dragdrop.js Line: 198` Warning: anonymous function does not always return a value Source File: http://tltc.la.utexas.edu/rr/js/scriptaculous/dragdrop.js Line: 540, Column: 40 Source Code: return Sortable.sortables[element.id]; Warning: function gettrailobjnostyle does not always return a value Source File: http://tltc.la.utexas.edu/rr/js/searchover.js Line: 29, Column: 20 Source Code: } --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
can you post the errors so i can see whats happening - Original Message - From: "terry-5-" To: "Prototype & script.aculo.us" Sent: Tuesday, June 02, 2009 9:20 PM Subject: [Proto-Scripty] Re: Revert sortable on return value true? Possible? > > Thanks Alex. > > > --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
Thanks Alex. --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
i'll investigate in the morning for you - Original Message - From: "terry-5-" To: "Prototype & script.aculo.us" Sent: Tuesday, June 02, 2009 5:48 PM Subject: [Proto-Scripty] Re: Revert sortable on return value true? Possible? > > Hi Alex, > > Thanks for being so patient. I deleted the previous message because I > saw your link to the patch after I submitted it. Wow, this is just a > mistery to me, but I added the patch, added revert to the sortable > decleration, checked the return value which is true for what I am > checking and still it doesn't work. > > I get a lot of warnings in firebug for prototyp.js, effects.js, and > dragdrop.js. > I haven't invastigated, but I don't think it has anything directly to > do with the patch. Does the patch only work with a certain version of > the files? > > Sortable.create('blank_1',{tag:'span',dropOnEmpty: true, > constraint:true, containment:sections, only:'lineitem', > onUpdate:function(el){changeClass(el)}, revert:changeClass}); > > function changeClass(el){ > var flag =false; > var sections = document.getElementsByClassName('section'); > > sections.each(function(section) { > var sectionID = el.id; > var sectionall_ID = section.id; > var sequence=(Sortable.sequence(el.id)); > }); > > str_post=str_post.join(","); > if(str_post.match(",")){ > flag =true; > } > alert((flag == true)?true:false); > return (flag == true)?true:false; > } > > > --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
Hi Alex, Thanks for being so patient. I deleted the previous message because I saw your link to the patch after I submitted it. Wow, this is just a mistery to me, but I added the patch, added revert to the sortable decleration, checked the return value which is true for what I am checking and still it doesn't work. I get a lot of warnings in firebug for prototyp.js, effects.js, and dragdrop.js. I haven't invastigated, but I don't think it has anything directly to do with the patch. Does the patch only work with a certain version of the files? Sortable.create('blank_1',{tag:'span',dropOnEmpty: true, constraint:true, containment:sections, only:'lineitem', onUpdate:function(el){changeClass(el)}, revert:changeClass}); function changeClass(el){ var flag =false; var sections = document.getElementsByClassName('section'); sections.each(function(section) { var sectionID = el.id; var sectionall_ID = section.id; var sequence=(Sortable.sequence(el.id)); }); str_post=str_post.join(","); if(str_post.match(",")){ flag =true; } alert((flag == true)?true:false); return (flag == true)?true:false; } --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
if you look in the patch it sets the variables inside it ... I think it goes element,Old,New or someting Alex - Original Message - From: "terry-5-" To: "Prototype & script.aculo.us" Sent: Monday, June 01, 2009 11:12 PM Subject: [Proto-Scripty] Re: Revert sortable on return value true? Possible? Thanks so much Alex, I am just not sure about Element.hasClassName(el,n.id). First I tried to have revert:changeClass follow directly after onUpdate:function(el) {...}, but the script stopped working. So then I included revert:changeClass inside the update function and I tried to pass "this" to revert:changeClass, but that didn't work. If I test for this.id in changeClass I get an undefined. Are the objects/variables Element, o, and n predefined? Thanks, Nathalie I will give it a try. On Jun 1, 10:44 am, "Alex McAuley" wrote: > First a patch is neededhttp://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-" > To: "Prototype & script.aculo.us" > > 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
Thanks so much Alex, I am just not sure about Element.hasClassName(el,n.id). First I tried to have revert:changeClass follow directly after onUpdate:function(el) {...}, but the script stopped working. So then I included revert:changeClass inside the update function and I tried to pass "this" to revert:changeClass, but that didn't work. If I test for this.id in changeClass I get an undefined. Are the objects/variables Element, o, and n predefined? Thanks, Nathalie I will give it a try. On Jun 1, 10:44 am, "Alex McAuley" wrote: > First a patch is neededhttp://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-" > To: "Prototype & script.aculo.us" > 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Revert sortable on return value true? Possible?
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-" To: "Prototype & script.aculo.us" 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---