Hi Walter and david, thanks for your input.
@Walter: Maybe I gave a wrong impression. I am already doing it like you suggested. I go even further: the current status of the sorted list will only be saved when the user clicks a button "I am done sorting, save this". In my case it wouldn't be good to save the sort order via ajax. The only thing what I need to to while sorting the list is to change value, name and options of an additional select box that is included in each sortable <li>. I figured out how to change these select-boxes with a better performance. First of all and most importantly only these select boxes are changed that needs to be changed. The second mistake was that I always created a new select box instead of just altering the old one. This also helped a lot. I found out that Sortable.create also has problems with lists containing 500 elements. I turned off Sortable when lists that big occur. On 28 Mai, 15:29, Walter Lee Davis <wa...@wdstudio.com> wrote: > 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 -~----------~----~----~----~------~----~------~--~---