dokuwiki-plugin-struct
dokuwiki-plugin-struct copied to clipboard
Feature request: add class to table header according to field type
I would like to add classes to table headers
AggregationTable::renderColumnHeaders() would be the place
https://github.com/cosmocode/dokuwiki-plugin-struct/blob/7fe2cdf28c472c686961bf42f0123eb33d2f3e60/meta/AggregationTable.php#L231-L235
Thanks Andi for the pointer!
I did this (just for the records):
// output XHTML header
$this->renderer->doc .= '<th ';
if ( is_a($column->getType(), '\dokuwiki\plugin\struct\types\User') ) {
$this->renderer->doc .= 'class="struct_user" ';
}
$this->renderer->doc .= "$width $data>";
I picked this up again and it workes for me like this, because I need this for struct type user, right now.
However, I would really find this useful for all headers (and all types). But, I don't know, how to do it. 😄
Cheers!
And I replaced the line 367 here https://codesearch.dokuwiki.org/xref/plugin/struct/meta/AggregationTable.php#367 by the following three lines:
$fieldinfo = 'data-field="' . $this->columns[$colnum]->getFullQualifiedLabel() . '"';
$colclass = 'class="col' . $colnum . '"';
$this->renderer->doc .= "<td $colclass $fieldinfo>";
This puts the schema.Title info into each table data cell td.
Now, I can go in CSS, like this:
[data-field="schema.Title"] { display: none; }
... which hides the whole column. Any other CSS rules per column are possible, now.
See here: https://forum.dokuwiki.org/d/22299-feld-vorbelegen-im-seriellen-editor