0

I'm working with SharePoint 2010. I've created a calculated column B which displays bubble images of 2 colors based on the value of column A. Now, the issue is that on the list view, if an user clicks on the menu option next to column B, he can see 2 filter choices which are image links inside the div tag. Can these filter choices be changed to column A values e.g., checked, unchecked (Column A is a yes/no checkbox field)? This will make the filter choices more meaningful. Thanks.

Note: Don't have access to SharePoint Designer.

1 Answer 1

1

No, if you put HTML inside a Calculated Column (and set the datatype to anything but single-line of text to output the HTML) the bare HTML code itself will be displayed in the filter choices.

Only in the View is the HTML code not escaped;
it will appear as bare HTML on Forms, in Alert emails and more places.

A way too complex workaround is to add JavaScript in a Calculated Column (as last column in the View) it doesn't display anything but (after the View is displayed) traverses back all the current row cells replacing any values with your Images. That way the filter settings will not have been created with bare HTML code. You could achieve the same with a longer (and more complex row logic) script that processes the whole View.

But that is serious scripting, I have done this for years and it will still take me half a day on a new SP 2010 project.

In SP2013 all this fiddling with HTML code in weird places is no longer required because CSR (Client Side Rendering) will take care of properly displaying your HTML code and the Values in the column filters.

Update #1

I answered another question and you might be able to use this code as well.

var fieldname ='DueDate';
var label = document.querySelector("a[id$='" + fieldname + "']");
if (label) label.parentNode.innerHTML='ColumnName';

In a CEWP below the View

7
  • Can I use CSS to hide the two filter choices for column B?
    – Heathen007
    May 1, 2016 at 17:58
  • Yes, that would be possible.. but.. those filter options are created async.. so you would have to wait till they are created in the DOM before you can (re)apply CSS. Use something like the StyleBot plugin to fiddle with the CSS. Note: this does require very good understanding of CSS selectors May 2, 2016 at 8:54
  • Is there any way I can disable the open menu option for this column?
    – Heathen007
    May 2, 2016 at 18:40
  • CSS or JavaScript; same issue (JS even more complex than CSS) you need to alter the UI after all is created.. Trust me.. I have checked every option when I built the www.ViewMaster365.com App years ago. May 2, 2016 at 19:19
  • I guess I was too stupid back then and didn't try all the options... May 3, 2016 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.