@@.persontable
|>| @@display:block;width:23em;<div class="lightgrey">''[Tiddler-specific title]''</div>@@ |
|^@@display:block;width:6.5em;''Value 1''@@ |@@display:block;width:15em;Tiddler-specific text 1@@ |
|^@@display:block;width:6.5em;''Value 2''@@ |@@display:block;width:15em;Tiddler-specific text 2@@ |
|^@@display:block;width:6.5em;''Value 3''@@ |@@display:block;width:15em;Tiddler-specific text 3@@ |
@@@@.persontable
|>| @@display:block;width:23em;<div class="lightgrey">''[Tiddler-specific title]''</div>@@ |
|^@@display:block;width:6.5em;''Value 1''@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 2''@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 3''@@ |@@display:block;width:15em;@@ |
@@.persontable {
margin-left: auto;
margin-right: 0;
margin-left: 1em;
float: right;
font-size: 0.8em;
}
.persontable td,
.persontable tr,
.persontable th,
.persontable tbody
{ border :0 !important;
padding-top: 0.5em;
}
.lightgrey {
background-color:lightgrey;
}{{Templatepersontable}}@@.persontable
|>| @@display:block;width:23em;<div class="lightgrey">''[Tiddler-specific title]''</div>@@ |
|^@@display:block;width:6.5em;{{!!value1}}@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 2''@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 3''@@ |@@display:block;width:15em;@@ |
@@|^@@display:block;width:6.5em;''Value 1''@@ |@@display:block;width:15em;{{!!value1}}@@ |
|^@@display:block;width:6.5em;''Value 1''@@ |@@display:block;width:15em;''{{!!value1}}''@@ |<$button> widget and I guess I could have one in the Home tiddler making it so that it would create a new tiddler with the tags needed, but it's important that new pages are created when clicking in missing links in other tiddlers. I imagine tags are the way to do what I want, but google isn't helping me here.
|>| @@display:block;width:23em;<div class= "{{!!tablecolor}}">''{{!!tablename}}''</div>@@ |
\define mytable(colorclass)
|persontable $colorclass$|k
|>| @@display:block;width:23em;<div class="lightgrey">''[Tiddler-specific title]''</div>@@ |
|^@@display:block;width:6.5em; ''Value 1'' @@ |@@display:block;width:15em;{{!!value1}}@@ |
|^@@display:block;width:6.5em;''Value 2''@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 3''@@ |@@display:block;width:15em;@@ |
\end
<$macrocall $name="mytable" colorclass={{!!tablecolor}}/>\define mytable(colorclass)
|persontable $colorclass$|k
|>| @@display:block;width:23em;<div class="lightgrey">''[Tiddler-specific title]''</div>@@ |
|^@@display:block;width:6.5em; ''Value 1'' @@ |@@display:block;width:15em;{{!!value1}}@@ |
|^@@display:block;width:6.5em;''Value 2''@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 3''@@ |@@display:block;width:15em;@@ |
\end
<$macrocall $name="mytable" colorclass={{!!tablecolor}}/>Tables can add their own class with a line like:|firstclass secondclass|kat the start.
I know there's something obvious I'm overlooking, but how do I add another class for yellow, for example? if I have this in a "mytable" tiddler:\define mytable(colorclass)
|persontable $colorclass$|k|>| @@display:block;width:23em;<div class="lightgrey">''[Tiddler-specific title]''</div>@@ ||^@@display:block;width:6.5em; ''Value 1'' @@ |@@display:block;width:15em;{{!!value1}}@@ ||^@@display:block;width:6.5em;''Value 2''@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 3''@@ |@@display:block;width:15em;@@ |
\end
<$macrocall $name="mytable" colorclass={{!!tablecolor}}/>
And then call the template with {{mytable}} in "Person 1", the cell comes out as lightgrey without any "colorclass" field. I imagine the solution as to do with what you said here:
Tables can add their own class with a line like:|firstclass secondclass|kat the start.
But playing around that second column only produces errors...
\define mytable(colorclass)
|persontable $lightgrey$ $yellow$|k
|>| @@display:block;width:23em;<div class="lightgrey">''[Tiddler-specific title]''</div>@@ |
|^@@display:block;width:6.5em; ''Value 1'' @@ |@@display:block;width:15em;{{!!value1}}@@ |
|^@@display:block;width:6.5em;''Value 2''@@ |@@display:block;width:15em;@@ |
|^@@display:block;width:6.5em;''Value 3''@@ |@@display:block;width:15em;@@ |
\end
<$macrocall $name="mytable" colorclass={{!!tablecolor}}/>
So, what I want is just to have that grey in that one cell to be easily changeable, since it will save me from having dozens of templates (one color for each family).
With your second files, I tried different solutions to solve this:
- First I changed the "color" to "background-color". However, it colored the entire table, including the padding;
- Then I tried ending the class inside the table somehow, so that only the title had the background. This didn't work, as it breaks the code;
- Then, tried creating two tables: one for the title, another for the rest of the table (both class="persontable"). Had to insert "<div style = "clear:both;"></div>" between the two to make them appear on top of eachother, but it retains a space between the two. Managed to remove it with margins, but a small border between the two still remains. I'll probably be able to remove it, but it's not worth it if I don't solve the final issues:
- The fact that the background color includes the padding, and the fact that it's not centered or bold. Managed to make it centered by substituting the <<>> with {{!tabletitle}} and adding "text-align:center;", but neither '' '' nor <b></b> work for bold as they did before. As for padding, changing it in "MyStyles" only makes the cell larger...it's still completely colored, instead of having the bit of color-less padding like in my example.
At this point, I'm considering just creating one template for each color, it seems easier.
What do you think? Is there an easy solution, or should I give up?
Rafael
\define mytable(colorclass)
<table class="persontable ">
<tr><td colspan=2 bgcolor=$colorclass$> @@display:block;width:23em;color:lightgrey; <<currentTiddler>> @@ </td></tr>
<tr><td> ''Value 1'' </td><td>@@display:block;width:15em;{{!!value1}}@@</td></tr>
<tr><td>@@display:block;width:6.5em;''Value 2''@@ </td><td>@@display:block;width:15em;stuff@@ </td></tr>
<tr><td>@@display:block;width:6.5em;''Value 3''@@ </td><td>@@display:block;width:15em;@@ </td></tr>
</table>
\end
<$macrocall $name="mytable" colorclass={{!!tablecolor}}/>

Instead of this (just built it manually, so the color is slightly different):

border-collapse: separate;
to get the kind of border you wanted.
I think at this point the particular parts of what you wanted are in place. The template is applied
automatically and the table is constructed for you. Now it's a matter of just working out the exact
CSS and HTML to tweak the look. I can't help much with that -- I usually just google whatever
I'm trying to achieve and then just try all sorts of things. It becomes a little more complicated
in TW because so there is already so much CSS floating around. Like "border-collapse" must have something
somewhere setting it's status differently than the default.
Good luck!
-- Mark
\define mytable(colorclass)
<div class="specialTable">
<table class="persontable ">
<tr><th colspan=2 style="background-color:$colorclass$;"> @@display:block;color:lightgrey; <<currentTiddler>> @@ </th></tr>
<tr><td> ''Value 1'' </td><td>@@display:block;width:15em;{{!!value1}}@@</td></tr>
<tr><td>@@display:block;width:6.5em;''Value 2''@@ </td><td>@@display:block;width:15em;stuff@@ </td></tr>
<tr><td>@@display:block;width:6.5em;''Value 3''@@ </td><td>@@display:block;width:15em;@@ </td></tr>
</table>
</div>
<div style="clear:both">
</div>
\end
<$macrocall $name="mytable" colorclass={{!!tablecolor}}/>.specialTable {
float: right;
}
[data-tags*=myTable] .tc-tiddler-body
{
width:40% ;
float: left;
}