[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Support for sortable HTML tables?
On Mon, Jan 08, 2007 at 05:21:58PM -0600, David Cramer (Tech Pubs) wrote:
> Can the javascript be made to key off of a <div class="sortable"> around
> the table? If so, you could use apply-imports in your customization
> layer:
Many thanks, this seems to work well! My customisation is now:
<xsl:template name="user.head.content">
<script type="text/javascript" src="sorttable.js"/>
</xsl:template>
<xsl:template match="tgroup[../../*[@role='sortable']]" >
<div class="sortable">
<xsl:attribute name="id">
<xsl:value-of select="generate-id(.)"/>
</xsl:attribute>
<xsl:apply-imports/>
</div>
</xsl:template>
The change to
http://kryogenix.org/code/browser/sorttable/sorttable.js is:
8c8
< tbls = document.getElementsByTagName("table");
---
> tbls = document.getElementsByTagName("div");
13c13,14
< ts_makeSortable(thisTbl);
---
> thetable = thisTbl.getElementsByTagName("table")[0];
> ts_makeSortable(thetable);
Using a JavaScript library such as jQuery would make the element
selection even more easy:
$("//div[@class='sortable']/table").each(function(i){
ts_makeSortable(this);})
Cheers,
--
W. Borgert <debacle@debian.org>, http://people.debian.org/~debacle/
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]