As in the title : is there a way to add a class to a particular ROW in a table, or to an individual cell? So I can for example apply a negative/positive class or a colour to either?
See https://semantic-ui.com/collections/table.html#positive--negative for an example of what I'm after
Bump, would very much like this please.
No. I need to be able to add the CLASS to the row or cell to be able to target it with CSS and there's no way (currently that I can see) to add it in CCv6
no. Row and cell not column.
Okay so I need it programmatically. So for example, if classFee is 1.5 then add "classA" to the row. If classFee is 2 add "classB" to the cell.
Thanks for the input but again I need it added to the cell or individual row itself.
OK
And there I am stuck since as far as I can see and from my usage that method does add css to a specific cell admittedly via the tag style attribute based on the cell content.
😶
Nick
No you're adding a class to content INSIDE the cell.
OK - I see that difference. I shall ponder further - it needs some sort of css:parent selector. I wonder if one can add a {fn:...} to the Column Classes box or the Columns Views box.
Nick
There is no css parent selector, and even if there was that's still not what I need. I want to utilise Semantic-UIs table behaviour for positive / negative cell entries.
I'll probably just have to see if I can modify the PHP files for CC and add the requisite options to the table builder.
No - there is not for reasons explained elsewhere - but a pity.
I shall watch with interest.
OK I got it. I modified table_config to add a row option and table_output to display it. You can add text classes in there or function calls - but for some reason if you call a PHP function it has to echo your class string instead of returning the string.
[file=10801]table_config.php.txt[/file]
[file=10802]table_output.php.txt[/file]
USAGE: remove the '.txt' and upload the files to /server/path/public_html/yoursite/libraries/cegcore2/admin/extensions/chronofc/views/table
REMEMBER: These additions will be overwritten when you update chronoforms/connectivity.
Thanks for that.
Noted 'REMEMBER: These additions will be overwritten when you update chronoforms/connectivity.'
This just adds the class to the ROW though not individual cells. I can do that later but for my purposes the row was more important.
Perhaps Max will pick up and add to the base set.
I sent my code to him via email. Hopefully he'll make a nicer version of it and add it in.
@healyhatman,
Can you provide an example of putting this into action, with one of my tables I wish to colour a row depending on a value that isn't displayed on the table but is held within the function that is being displayed.
I presume that I would be looking at a php routine to check if the row contains the required value and then outputs the class based on it.
I have no idea if this is achievable or not, within the Functions area I have only ever used the read database functions!
{fn:some function}
The data you need should be stored in $this->get("table_name.row.model.field", "default");