Filter on TH
3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: April 3, 2013 (RSS)
By Djulia - April 3, 2013
Hi,
Is it possible to use a filter on the tags TH of the pages lists?
I tested the following code, but that does not function.
addFilter('listRow_thStyle', '_alignThOnList', null, 3);
function _alignThOnList($thStyle, $tableName, $fieldname) {
...
if ($fieldname = 'num_value') { $thStyle = "text-align:right;"; }
return $thStyle;
}
Thanks for your assistance.
Djulia
By gregThomas - April 3, 2013
Hi Djulia,
You're close, the filter you need to use to change the styling on the table header rows is listHeader_thAttributes, I've also made a couple of extra changes to your code:
addFilter('listHeader_thAttributes', '_alignThOnList', null, 3);
function _alignThOnList($thStyle, $tableName, $fieldname) {
if ($fieldname = 'num_value') { $thStyle .= ' style="text-align:right;"'; }
return $thStyle;
}
I've added the correct filter, and also changed the the code so that the style gets appended to the current string as opposed to overwriting it, as CMS Builder might have added its own attributes to the tag.
Thanks!
Greg
PHP Programmer - interactivetools.com