Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
Suggested answer

Hide row in List on Portals with Javascript

(1) ShareShare
ReportReport
Posted on by 4

Trying to hide all rows in this service list where the application id (Lookup field) for service does not match the application id for that application.

 

I'm pretty sure this can be done in JavaScript, but I am not sure how to go about that.

robertsapps_0-1683237503257.png

robertsapps_1-1683237612585.png

 

So basically I would want to check if the Application column for each row matches the 

{{ request.params.id }}

 

Thanks in advance!

Categories:
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,230 Most Valuable Professional on at
    Hide row in List on Portals with Javascript
    I can help with the JS code, not a problem, but my first question here is:
    • is this a list or a subgrid?
    • is the other Applications for the same Contact/User or is it displaying Services for applications from all users? 
  • Suggested answer
    SaiRT14 Profile Picture
    1,961 Super User 2025 Season 1 on at
    Hide row in List on Portals with Javascript
    pls try the following:
    document.addEventListener("DOMContentLoaded", function() {
        // Define the target Application ID you want to match
        const targetApplicationId = "12345"; // Replace with the specific Application ID you want to match
        // Get all rows in the service list table
        const serviceListTable = document.getElementById("serviceListTable"); // Replace with actual table ID or selector
        const rows = serviceListTable.getElementsByTagName("tr");
        // Iterate over each row, starting from index 1 to skip the header
        for (let i = 1; i < rows.length; i++) {
            const applicationIdCell = rows[i].querySelector(".applicationIdCell"); // Replace with the actual class or selector for the Application ID cell
            if (applicationIdCell) {
                const applicationId = applicationIdCell.textContent || applicationIdCell.innerText;
                
                // Hide the row if the Application ID does not match the target ID
                if (applicationId.trim() !== targetApplicationId) {
                    rows[i].style.display = "none";
                }
            }
        }
    });
     
  • CU11111813-1 Profile Picture
    10 on at
    Hide row in List on Portals with Javascript
    Something like this should work: 
    $("#my-table td.field/cell:not(:equals('{{ request.params.id }}'))").parent().hide();
    You will have to figure out what the selector is for your markup.
    A better way is to filter the table before so you don't have to write this jquery. This may already work without additional filtering if you configured the view/grid properly in crm
     
  • ZackS Profile Picture
    104 on at
    Hide row in List on Portals with Javascript
    Same question here, any answers from microsoft yet?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,513 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,636 Most Valuable Professional

Leaderboard

Featured topics