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.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Morasta’s picture

Took 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.

Morasta’s picture

Status: Active » Needs review
Morasta’s picture

Still 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.

dqd’s picture

Status: Needs review » Closed (outdated)

We 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.