I originally created this as support request, and stated that "I'm relatively sure this isn't a bug, because if it were, I'd certainly have found an issue for it." - but since then, I've realized it is, most likely, a bug in the Views Calc module, so I've moved it here and updated this OP.

[See additional details in post #4.]

I went to the settings for my field, clicked to expand "Style settings", checked "Customize field HTML", left "HTML Element" on "Use default", checked "Create a CSS class" and entered "my-class".

I updated the preview (in Views) and inspected the markup for that field. That class is not there. Just to be sure, I saved the view, refreshed the page and inspected again - still not there. Also, to be doubly sure, I cleared all caches, and even cleared the Views cache (even though Views caching is disabled in my dev environment). Still nothing.

I've also tried the Field Formatter Class module, but it won't add a class to the field either. I don't have any templates overriding the View - at any level (field, display, or view).

CommentFileSizeAuthor
#5 field-settings.png84.53 KBExTexan
#5 field-html.png127.14 KBExTexan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ExTexan created an issue. See original summary.

aadil.addweb’s picture

It works fine at my end. I added class to the field and I am able to see that class in inspect element of that field.

ankur.addweb’s picture

Can you please provide output of your view field and also which format you are using?

ExTexan’s picture

Ok, I was grabbing screenshots to post here for you, but then I saw that the classes are being rendered now - at least on a display I added to that view that does (almost) the same thing as the original. I created the new display because of an issue I was having adding an "Edit" link. Now, other than the Edit link, the only difference between the view that's working and the one that isn't is that one is "Table" format, the other is "Views Calc Table". [I'll move this issue to that module.]

Additional info re: the issue... I've uploaded two more screenshots. One shows the Style settings of one of the fields, to show the class I added. The other shows the HTML of all fields in that view. As you can see, there's something strange going on with the classes. Some of the fields I've specified to be centered, others as right-justified. The classes that handle that are being duplicated, and there appears to be an extra space between the two duplicates (not sure if that's a helpful clue, but there it is).

I suspect that the field class I specified not showing is tied into this issue somehow. The other display I created, with format "Table" shows the classes rendered correctly.

ExTexan’s picture

FileSize
127.14 KB
84.53 KB
ExTexan’s picture

Title: CSS Class not working » CSS Class not being rendered
Project: Views (for Drupal 7) » Views Calc
Version: 7.x-3.x-dev » 7.x-1.x-dev
Component: table style » Miscellaneous
Category: Support request » Bug report
ExTexan’s picture

Issue summary: View changes