Hi all: I''m using sortable (very cool stuff!) on a series of divs with an onUpdate callback. Everything appears to work alright until I try to pass a parameter to my callback function like this: Sortable.create( ''page_33'', { tag: ''div'', onUpdate: updateOrder(''page_33'') } ); When I pass that parameter to the updateOrder function (as opposed to just using the updateOrder function without a call back) I get the following error in my JavaScript console: "Options has no properties (dragdrop.js line 870)" My call back function looks like this: function updateOrder(elementid) { var options = { method : ''post'', parameters : Sortable.serialize(elementid) }; new Ajax.Request(''test.php'', options); } I would greatly appreciate if anyone has any suggestions as to how I might successfully pass a parameter to my updateOrder function without causing the Scriptaculous stuff to crash and burn. I''m willing to bet that this is all just because of my general lack of experience with JavaScript but I''m hoping I might be wrong (just this once). Thank you in advance, Matt -- Matt Adams Developer, Cypress Interactive http://www.cypressinteractive.com
Martin Bialasinski
2006-Apr-14 08:17 UTC
Re: Problems using Sortable with an onUpdate callback
On 4/14/06, Matt Adams <matt-h800zs0ozez6NYY1LaVeLRdDcuvq+h7I@public.gmane.org> wrote:> onUpdate: updateOrder(''page_33'')This calls updateOrder at once and assigns the result to onUpdate. () means "execute the function". Use onUpdate: updateOrder.bind(this, ''page_33'') For more details search the mailing list archive for the thread "Prototype Ajax - How to pass my own params to onComplete ?" from this week. Bye, Martin