Re: Saving Drag/Drop Sortable to DB

2011-03-18 Thread cricket
On Thu, Mar 17, 2011 at 10:42 AM, Warren wrote: > I think you have to reset the active record in your for each loop, try this > : > > foreach ($ids as $id) { >                $this->Item->id = $id; >                $this->Item->saveField('sort_order', $i++); >                $this->Item->create();

Re: Saving Drag/Drop Sortable to DB

2011-03-17 Thread Warren
I think you have to reset the active record in your for each loop, try this : foreach ($ids as $id) { $this->Item->id = $id; $this->Item->saveField('sort_order', $i++); $this->Item->create(); } On 17/03/2011 12:48, Ryan wrote: I'm t

Re: Saving Drag/Drop Sortable to DB

2011-03-17 Thread Ryan
Thanks for the help - I did figure out my issue though...I use ACL also and didn't add the right acos/aros permissions for it. It didn't occur to me that the user would need access to the sort function, oops! On Mar 17, 4:25 pm, cricket wrote: > On Thu, Mar 17, 2011 at 4:07 PM, cricket wrote: >

Re: Saving Drag/Drop Sortable to DB

2011-03-17 Thread cricket
On Thu, Mar 17, 2011 at 4:07 PM, cricket wrote: > I can't tell you anything about Cake's sort I meant Cake's AJAX sort. My models do use this SortableBehavior: http://bakery.cakephp.org/articles/dardosordi/2008/07/29/sortablebehavior-sort-your-models-arbitrarily -- Our newest site for the commu

Re: Saving Drag/Drop Sortable to DB

2011-03-17 Thread cricket
On Thu, Mar 17, 2011 at 6:48 AM, Ryan wrote: > I'm trying to display a list of items from the database and let the > user drag them around to sort them however they like. Each time they > drag something, a function should fire that loops through all of the > rows and saves the sort order to the da

Saving Drag/Drop Sortable to DB

2011-03-17 Thread Ryan
I'm trying to display a list of items from the database and let the user drag them around to sort them however they like. Each time they drag something, a function should fire that loops through all of the rows and saves the sort order to the database so that the next time the user loads that page,