Skip to main content

Notifications

Power Pages - Customize & Extend
Unanswered

Hide row in List on Portals with Javascript

Posted on 4 May 2023 22:01:26 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
    SaiRT14 Profile Picture
    SaiRT14 911 on 14 Nov 2024 at 22:03:35
    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
    CU11111813-1 10 on 11 Nov 2024 at 19:52:31
    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
    ZackS 57 on 05 Nov 2024 at 17:15:46
    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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,129

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,797

Leaderboard

Featured topics