Making your tables sortable
This Tutorial applies to:
Any version.
This Tutorial is intended for:
Integrators, Customizers
tesdal
All content on one page (useful for printing, presentation mode etc.)
- Making tables sortable using Javascript Plone includes a handy javascript to make tables sortable in the browser. The javascript is included in the standard plone headers, so you don't have to touch javascript at all. To make your tables sortable, all you have to do is follow these easy steps.
- Make tables sortable in Plone 2.1 Plone has a "Safe HTML" transform that filters the thead element in tables, making it impossible to create sortable tables when editing your content. Fortunately this is easy to fix.
Does not work for me
I've tried it in Firefox 1.5 and IE6 and i can't get tables to sort. I've created a page and used your sample code and one with more rows and columns but when it's displayed there's no links to sort with.
oh,
by the way, I'm Using Plone 2.1.2 and Zope 2.9.0
How to get sortable tables working in plone 2.1
Sortable tables won't work by default on Plone 2.1, because the "Safe Html" transformation removes the tags from the Anyway, go to your Zope Management Interface, and go to your Plone site's configuration, and visit portal_transforms->safe_html->valid_tags. In there, add (reply was truncated?!) To get sortable tables to work in Plone 2.1, you need to add the (reply truncated?!) Navigate to your Plone site's configuration, and visit portal_transforms->safe_html->valid_tags. In there, add For any issues with the web site functionality, please
file a ticket.
Please consult the
policy on plone.org content
if you want your content published on this site.
! These are required in order for the table sorting javascript to work, I guess.
thead and 1 to the table of valid HTML. After you save it, restart your zope (important!). You should have sortable tables! See http://perry.kundert.ca/domain/plone/sorted-tables-in-javascript for more info.
Getting sortable tables to work in Plone 2.1 (continued)
thead tag to your Plone site's portal_transforms->safe_html->valid_tags configuration. In there, add thead and 1 to the table of valid HTML. After you save it, restart your zope (important!). You should have sortable tables.
How to get sortable tables working in plone 2.1 (cont.)
thead and 1 to the table of valid HTML. After you save it, restart your zope (important). You should have sortable tables!
"safe html" in plone 3 as well
bug in plone 3
how to mess up your table sort
I created a table, following the instructions here, containing 7 rows and 5 columns. It sorted exactly as advertised. I then inserted blank lines as spacers between rows, in the HTML, and added a bunch of comments. The sort time became so large that it was effectively broken. I removed all the comments and left in the spaces. Didn't help. I removed all the spaces. I got quick sort functionality back.
After considerable experimenting, what I learned was that comments in the HTML seem to have NO effect on the sort. Only a few blank lines, however, have considerable negative effect. YOU MUST NOT HAVE BLANK LINES IN YOUR HTML, if don't want your javascript sort to degrade unbearably.
My sortable table now works perfectly again - tons of comments, and NO blank lines!