Hello,
I have an entity list which has 3 views in the view selector. I would like to hide views based on the user's web roles with javascript. I am able to capture the web roles from a liquid tag, but cannot figure out how to hide an individual view. The sample code i get with Copilot is:
$(document).ready(function() {
// Wait for the entity list to load
$(".entitylist").on("loaded", function() {
var roles = '{{ user.roles }}'; // Get the user's roles
// Find the dropdown menu for views
var viewDropdown = $(this).find(".view-select");
// Find the option for the view you want to hide and hide it
viewDropdown.find('option[value="Portal Teachers - System-Wide"]').hide();
});
});
The view does not hide. I would like to do this without creating a web template which is a suggestion in another post. Is this possible?