You are here: Foswiki>Tasks Web>Item13436 (03 Feb 2016, GeorgeClark)Edit Attach

Item13436: Adding the class parameter to the TablePlugin

pencil
Priority: Enhancement
Current State: Closed
Released In: 2.1.0
Target Release: minor
Applies To: Extension
Component: TablePlugin
Branches: master Item13897
Reported By: MarcKloter
Waiting For: GeorgeClark
Last Change By: GeorgeClark
Hey

Since there was no way to give tables a class using the TablePlugin and it was only little code, I created the following patch:

--- lib/Foswiki/Plugins/TablePlugin/Core.pm
+++ lib/Foswiki/Plugins/TablePlugin/Core.pm
@@ -313,6 +313,13 @@
           . $Foswiki::Plugins::TablePlugin::topic
           . ( $tableCount + 1 );
         _storeAttribute( 'id',         $id,                     $inCollection );
+        my $class =
+          defined $inParams->{class}
+          ? $defaultAttrs->{class}
+          . ' '
+          . $inParams->{class}
+          : $defaultAttrs->{class};
+         _storeAttribute( 'class',     $class,                  $inCollection );
         _storeAttribute( 'headerrows', $inParams->{headerrows}, $inCollection );
         _storeAttribute( 'footerrows', $inParams->{footerrows}, $inCollection );
     }

Just as the id, there will be a check if there is a class parameter and if so, just add the parameter to the default class (which is necessary for the css).

Tested on the 1.1.9 VM and the latest version of the TablePlugin.

-- MarcKloter - 28 May 2015

Crawford, this looks simple enough and quite reasonable. Look okay for 2.1?

-- GeorgeClark - 15 Dec 2015

Sure, I don't have a problem with it. I don't think the ERP needs to know about it.

-- Main.CrawfordCurrie - 28 Dec 2015 - 07:32

MarcKloter: Thanks for the patch. I'm adding this to the TablePlugin that will be released with Foswiki 2.1.

-- GeorgeClark - 30 Dec 2015

 
Topic revision: r6 - 03 Feb 2016, GeorgeClark - This page was cached on 18 Nov 2017 - 20:31.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License