Page 1 of 1

Hide listview group headers

Posted: 30 Jan 2019
by Adam Reyes
Is there a way to hide listview group headers in the form? I have a related items section inside the form and need to group by a certain field but would like to hide the header name. I know how to do this in SharePoint 2013 Web part page and script editor but it doesn't seem to work in Forms Designers Javascript framework:

<script src="/SiteAssets/JQuery/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("table.ms-listviewtable > tbody[id^='titl']").each(function () {
var htmlStr = $(this).find("td").clone().html();
//"Name" is the group name
htmlStr = htmlStr.replace(" :", "").replace("CAR Type", "");
$(this).find("td").html(htmlStr);
});
});
</script>
hide list headers.png
hide list headers.png (17.52 KiB) Viewed 2206 times

Re: Hide listview group headers

Posted: 31 Jan 2019
by AlexZver
Dear Adam,

Your code has already handled this issue, just paste it in the JavaScript Editor without <script> tags:

Code: Select all

$("table.ms-listviewtable > tbody[id^='titl']").each(function () {
var htmlStr = $(this).find("td").clone().html();
//"Name" is the group name
htmlStr = htmlStr.replace(" :", "").replace("CAR Type", "");
$(this).find("td").html(htmlStr);
});

Re: Hide listview group headers

Posted: 01 Feb 2019
by Adam Reyes
Ah I see what you did there, I didn't have to nest it into that first function. Thank you very much Alex!