jQuery Tablesorter – Eurobeträge sortieren

Abgelegt in JS, Webdevelopment, jQuery am 4. Februar 2010 von Tino

Das PlugIn jQuery Tablesorter ist schon etwas in die Jahre gekommen (letztes Update im März 2008 auf Version 2.0.3), ich benutze es aber noch immer sehr gern.

Mit unseren Zahlenformaten kommt es leider nicht so ohne weiteres zurecht. So wollte ich kürzlich auch das sortieren von Beträgen in Euro(z.B. 205,20 €) ermöglichen – da schlug aber immer nur die einfache String-Sortierung an. So kommt dann beispielsweise eine Reihenfolge von 80,00 €, 912,25 €, 95,00 € heraus.

Zum Glück lässt sich der Tablesorter sehr komfortabel mittels eigener Parser erweitern. Das Grundschema ist immer gleich und übrigens auch auf der Tablesorter-Seite erklärt:
Read more »

Benchmarking jQuery 1.4

Abgelegt in JS, Webdevelopment, jQuery am 18. Januar 2010 von Tino

When jQuery 1.4 came out last week I just finished a large project involving lots of ajax, XML-parsing and DOM-manipulation. In this backoffice-tool large tables replace other objects in the page and then events are being bound to cells, icons in the cells for context-menus …
What was reasonable fast with my test-data became a sleeping snail after the customer started working with it, adding some hundred lines of real data.
I figured out there were two extreme time-expensive things in what I was doing there:

  • injecting new elements in the site
  • eventbinding to lots of DOM-objects

The later was fixed easily and (as I think) nifty – I will talk about that in another post. The DOM-injection was a problem because jQuery is doing some clever things when deleting elements from the DOM to prevent memory-leaking. So simply using .innerHTML= instead of .html() was an option for me, but not one i liked.

So there was some excitement when I figured out that .empty() and .html() were among the things that had been speed up in jQuery 1.4.

I set up a testpage for my scenario (adding, removing and binding events to large tables) comparing jQuery 1.3.2 with 1.4 in Firefox 3.5.5 and see what I’ve got:
Read more »

Tags: , ,