I think you need to take a step back and think about what you're doing  
here. If you use Sortable to re-order a list, that list will stay  
ordered (in the visitor's view) precisely as they have dragged it.  
There is no need to re-populate the visitor's list with the new order,  
because the order is set there already. (Which is why it's so fast --  
you're not actually doing anything dramatic, just changing the order  
of existing elements.)

Each time you change a Sortable, the onUpdate function (if present) is  
fired. Use that to send an Ajax request back to the server and update  
the database, but don't actually pull anything else back from the  
server. Keep the current view of the page and the database "loosely  
coupled" like this and you will realize enormous performance gains.

If you follow this design pattern, then you will have the best of both  
worlds -- high performance AND database-backed state. At any point  
(assuming your onUpdate-driven POST goes through quickly enough)  
reloading the page should show you the very same list in the very same  
order as the drag-resorted-but-not-reloaded view you were just looking  
at.

Walter

On May 28, 2009, at 6:34 AM, david wrote:

>
> Hi Cyrus,
>
> I think you should try a simple $('element').innerHTML='the new
> value'; for each element to update
> Compared to js solution, it's quicker.
>
> Of course it depend to what you'll need to insert or change.
>
> --
> david
>
> On 28 mai, 11:52, Cyrus <arianglan...@googlemail.com> wrote:
>> Hi,
>>
>> I am using Sortable to sort potentially long lists of 100+ elements.
>>
>> Sortable itselfs works fast. Each list item contains a select-box  
>> with
>> its position. We want to keep that select box to have a non-js
>> fallback to sort the list.
>>
>> After each drag&drop the whole list has to be updated. I have to
>> change value, name and options of each select box.
>>
>> I am doing this by creating new html-code and using Element.replace()
>> to exchange the html.
>>
>> This is unfortunately very slow. I also tried to use insert() and  
>> then
>> remove() but it doesn't really work faster.
>>
>> Any suggestions?
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to