English > Scripts and Templates
Export template: HTML List (English + German)
svenne:
Due to compatibility problems I changed all fonts to standard sans serif... On most systems that's not much of a change, but on some it should look better now.
rick.ca:
8) Good work, as usual. Thanks!
mgpw4me@yahoo.com:
--- Quote from: svenne on November 16, 2010, 08:10:29 pm ---The sort itself is quite fast. Restructuring and rendering the page is the slow thing... Internet Explorer is almost the same, even a bit slower...
--- End quote ---
Have you considered putting the listbox in a DIV and using InnerHTML to write the entire select at once? Adding items to a list means the listbox has to be redrawn for each item....InnerHTML should render once. Hmmm...are you even using a listbox? I haven't looked.
I'm pulling 80,000 records from the database and putting them into a listbox in about 5 seconds.
svenne:
Thanks for the hints, I'm not using a listbox. Used an unordered list. I fetch all <li>-elements (have them in an array just as you get them with getelementsbytagname), sort them and put each one into place (without changing the <li>-elements themselves, so there would be no need to rerender those ...in theory). In fact, I thought browsers would wait with page rerendering until all elements are done cause by default page refresh is delayed until everything is in place... I will experiment to find the time consuming steps. Perhaps it's faster not to move the elements but to change their content with innerHTML. I will try a listbox, too. I can imagine you're right with that...
svenne:
Ok, the whole unordered list is completely taken out of the page now, then sorted, and put back as new unordered list into the page. Although the code looks more time-consuming, it is about three times faster with Firefox. With IE it is not that much, but it's faster. The time consuming step now is the sort function itself. There is a lot of potential for getting that faster, too, since for each comparison the necessary part (title, year, or date added) is extracted from the list elements. But for the time being I'm quite happy with the result...
Thanks for your tips, mgpw4me!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version