Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
In a view I have a field that displays a value. For display purposes, I added a custom class via
editing the view --> the field in question --> style settings --> check customize field HTML --> check Create a CSS class. Here I add something like priority-[field_val] which is then styled via the css. For what it's worth, "Add default classes" is also checked.
From what I can tell, DataTables doesn't use this setting, but it would be very helpful if it did.
One workaround is to rewrite the field using a
or , but that's not ideal in cases of spaces or other characters where it would be necessary to play string manipulation games.
Comment | File | Size | Author |
---|---|---|---|
#1 | DataTables-support-field-customize-html-2315317-1.patch | 607 bytes | Morasta |
Comments
Comment #1
Morasta CreditAttribution: Morasta commentedTook a few minutes and came up with a solution. Easy enough, just changed Line 33 datatables-view.tpl.php to
<td class="<?php print $field_classes[$field][$count]; ?>">
Attached a patch with the change. Currently working nicely on my site. Shouldn't break any existing stuff since the field class is still included in the new array val.
Comment #2
Morasta CreditAttribution: Morasta commentedComment #3
Morasta CreditAttribution: Morasta commentedStill an issue in the latest dev (as of 8.26.2014). Line 23 in the same file needs a similar fix for labels/headers, but I haven't had a chance to roll a patch for that yet.
Comment #4
dqdWe are on 7.x 2.x so I would say this issue can be closed for now and reopened with changed code version option if somebody wants to report it for 2.x.