You are here: Foswiki>Tasks Web>Item13688 (10 Oct 2015, GeorgeClark)Edit Attach

Item13688: TablePlugin injected css is overwritten by the default style sheets disabling any table attributes.

pencil
Priority: Urgent
Current State: Closed
Released In: 2.0.2
Target Release: patch
Applies To: Extension
Component: TablePlugin
Branches: master
Reported By: KennethLavrsen
Waiting For:
Last Change By: GeorgeClark
I noticed that all tables looked "sick" and with table headers hard to read.

I assumed it was my own old 1.1.9 {Plugins}{TablePlugin}{DefaultAttributes} or TABLEPLUGIN_TABLEATTRIBUTES that did not match some new colour scheme so I ignored it at first.

But now I tried to change it and I notice that no matter which value I put for the header background colour it is always ignored.

I have found the root cause.

The TablePlugin injects the colours defined in {Plugins}{TablePlugin}{DefaultAttributes} or TABLEPLUGIN_TABLEATTRIBUTES in some injected CSS AND additionally as old style HTML attributes.

But both are ignored because the style sheets are loaded AFTER this injection overriding everything earlier defined

I can see in 1.1.9 that the style sheets are loaded BEFORE the TablePlugin injects its modifications to the existing styles.

In 2.0 the style sheets are loaded at the end. This is wrong. A plugin injecting anything should be AFTER loading the default style sheets. Otherwise no plugin can influence anything. That order of loading needs to be changed back. I am not sure if it is the TablePlugin that injects the wrong way or it is the core that has changed its loading sequence. if that is the case then no plugins can modify any styles.

This is a release blocker bug

-- KennethLavrsen - 09 Sep 2015

Default styles:

head head head head
data data data data
data data data data
data data data data
data data data data

Custom styles:

head head head head
data data data data
data data data data
data data data data
data data data data

However once you replaced TablePlugin with JQTablePlugin table headers colors are not customizable anymore. This is due to the fact that JQT adds css styles targeting the <thead> element whereas PatternSkin's css is for &tl;th> elements.

-- Main.MichaelDaum - 09 Sep 2015 - 10:04

I do not have a JQTablePlugin listed as installed plugins. I did not replace anything. I am just displaying a table.

I can add the setting in question here

  • Set TABLEPLUGIN_TABLEATTRIBUTES = initdirection="down" tableborder="1" valign="top" headercolor="#000000" headerbg="#ffffff" headerbgsorted="#304050" databg="#ffffff,#edf4f9" databgsorted="#f1f7fc,#ddebf6" tablerules="rows" headerrules="cols" inlinemarkup="on"

-- KennethLavrsen - 09 Sep 2015

And you can actually see the TABLEPLUGIN_TABLEATTRIBUTES being ignored right here on this bug item. The first table should now have black header text on a white background.

-- KennethLavrsen - 09 Sep 2015

I tried to change foswiki.pattern.tmpl line 41 to

%TMPL:P{"head:meta"}%%TMPL:P{"head:css"}%%RENDERZONE{"head"}%%TMPL:P{"head:script"}%%RENDERZONE{"script"}%</head>%TMPL:END%

and then the table is rendered correctly.

I do not think it has anything to do with the JQ stuff

-- KennethLavrsen - 09 Sep 2015

Try this patch

diff --git a/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm b/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
index ba8a966..a51e4eb 100644
--- a/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
+++ b/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
@@ -1307,10 +1307,10 @@ sub _createCssStyles {
             $selector =~ s/xhover/hover/go;    # remove sorting hack
                  # TODO: optimize by combining identical rules
             if ( $selector eq '#' ) {
-                push @styles, "$tableSelector {$selectors}";
+                push @styles, "body $tableSelector {$selectors}";
             }
             else {
-                push @styles, "$tableSelector $selector {$selectors}";
+                push @styles, "body $tableSelector $selector {$selectors}";
             }
         }
     }
-- Main.MichaelDaum - 09 Sep 2015 - 12:00

Works great

-- KennethLavrsen - 09 Sep 2015
 

ItemTemplate edit

Summary TablePlugin injected css is overwritten by the default style sheets disabling any table attributes.
ReportedBy KennethLavrsen
Codebase 2.0.1, 2.0.0
SVN Range
AppliesTo Extension
Component TablePlugin
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:4f23f566902b
TargetRelease patch
ReleasedIn 2.0.2
CheckinsOnBranches master
trunkCheckins
masterCheckins distro:4f23f566902b
ItemBranchCheckins
Release01x01Checkins
Topic revision: r8 - 10 Oct 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy