Add class to element

Hi guys,

I have a need to conditionally set "hidden-*" or "visible-*" classes to certain elements for both header and cell in the list view. I can add the class on the element itself, but this needs to be done at runtime in php. I *could* generate some JS code in php to add to the page that use jQuery to add the classes, but I wondered if there was any more elegant way of doing it.

Best regards,
Arnor
 
I don't think there is a neat way of doing it baked in at the moment. There's a "use as cell class" on the element (so the value gets added as a class), but that wouldn't do it. And of course the element's List Settings "cell class" is not dynamic.

So you'll probably have to do it with either JS, or a custom template.

-- hugh
 
Hi Hugh,

I've been experimenting with this.

If I add this as jquery into the list_xx.js and just use hidden-desktop to test it, this executes too late - the columns show up and then are hidden, which is really not usable.

If I use PHP to generate JS into the page header using Joomla's addScriptDeclaration it seems to be too early as it doesn't add the class to the column.

I already have custom template, but it's a bit of a PITA to have to modify the template every time we want to make changes to what columns are hidden/visible. And it won't work for many of our lists that share tables and may need different hidden-*/visible-* classes on different columns, unless we basically create a template for every list, which I'm not doing. Hmmm.....

Best regards,
Arnor
 
I'm available on an hourly rate to add features to Fabrik. It would probably be possible to add an eval'ed option for the element class.

Sent from my HTC6545LVW using Tapatalk
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top