Saturday, October 1, 2011

Re: [Rails] Need hint. Refresh sortable-list after draging element

On Sep 23, 2011, at 5:14 AM, HG_Butte wrote:

> Hello,
>
> i implemented a dragable list semilar to railcast 147 and it works fine.
>
> Each item of my list has a value wich is accumulated ... like this
> • Value A = 3, Sum = 3
> • Value B = 4, Sum = 7
> • Value C = 1, Sum = 8
> When i drag Item C on item A i get this
> • Value C = 1, Sum = 8
> • Value A = 3, Sum = 3
> • Value B = 4, Sum = 7
> After reload the page it is shown correctly. But i woud like to refresh only the list to avoid traffic ...
> Maybe someone can give me a hint which command or technic i should use.

I'm a little confused. When you refresh the page, what do you see? The original order, or the newly sorted order?

If the latter, then there's no need to refresh the page at all. That's the whole point of an Ajax sortable -- your page layout is persisted back to the database, so you don't have to refresh the page. The new order is the new DOM order and (after a little back-channel traffic, is the new database order, too.

If you're looking for some confirmation that the new order "took", you might want to look at the highlight callback.

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate