Personal tools
You are here: Home Documentation Tutorials Making your tables sortable
tags from the
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Making your tables sortable

This Tutorial applies to: Any version.
This Tutorial is intended for: Integrators, Customizers

In this tutorial, Helge Tesdal from Plone Solutions will show you how to make your tables sortable with Javascript - just by using a simple declaration.

tesdal

All content on one page (useful for printing, presentation mode etc.)

  1. 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.
  2. 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.
 
by Helge Tesdal last modified February 12, 2006 - 15:17 All content is copyright Plone Foundation and the individual contributors.

how to mess up your table sort

Posted by tomcloyd at November 26, 2004 - 17:55

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!

Does not work for me

Posted by David Primmer at February 16, 2006 - 22:08

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,

Posted by David Primmer at February 17, 2006 - 05:58

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

Posted by Perry Kundert at May 12, 2006 - 13:09

Sortable tables won't work by default on Plone 2.1, because the "Safe Html" transformation removes the

! These are required in order for the table sorting javascript to work, I guess.

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

Posted by Perry Kundert at May 12, 2006 - 13:14

(reply was truncated?!)

To get sortable tables to work in Plone 2.1, you need to add the 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.)

Posted by Perry Kundert at May 12, 2006 - 13:19

(reply truncated?!) Navigate to your Plone site's configuration, and visit portal_transforms->safe_html->valid_tags. 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!

"safe html" in plone 3 as well

Posted by Ned Brush at December 7, 2007 - 17:00
I'm not 100% sure, but it looks like the same change required for v2.1 is also required for plone 3.

bug in plone 3

Posted by Ned Brush at December 7, 2007 - 23:46
It looks like there is bug with these sortable tables in Plone 3. Every time I edit the page containing the table, something automatically tacks on another arrowup.gif and breaks the sortability of the table. I can force it to work by copying in the original source for the table every time I edit the plone document.

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.

Servers and hosting by