web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : APsszCbIvey3PC1H9uPIWJ
Power Pages - Power Apps Portals
Answered

Javascript to check all cells are yes in a table and remove class from button

Like (0) ShareShare
ReportReport
Posted on 23 Sep 2020 09:49:16 by 59

Hi

 

Any help, guidance, is this right place for javascript questions for portal, i hope so.

 

I have an entity list and one column has a yes/no response .  I am trying to get it so that once all rows are completed and the answered column is all yes's then remove a class from a button so it can be clicked.

 

entitylist.PNG

 

I have this code already that colours the rows green when they are yes , but if i replace $(this).parent().addClass('success'); with $('mybtn).removeClass('disabled');  it would make the button active when any are yes

 

$(document).ready(function (){
$(".entitylist.entity-grid").on("loaded", function () {
$(this).children(".view-grid").find("td[data-attribute='py3_yescheck']").each(function (){
// do something with each row
if ($(this).text() == 'Yes') {
$(this).parent().addClass('success');
}
});
});
});
 

 

 

  • Verified answer
    justinburch Profile Picture
    Microsoft Employee on 23 Sep 2020 at 18:05:33
    Re: Javascript to check all cells are yes in a table and remove class from button

    Hi @sbonera,

    You need to identify the output of all iterations in the each statement. Consider the following:

    $(document).ready(function (){
     $(".entitylist.entity-grid").on("loaded", function () {
     var isSuccess = true;
     $(this).children(".view-grid").find("td[data-attribute='py3_yescheck']").each(function (){
     if ($(this).text() == 'No') {
     isSuccess = false;
     }
     });
     if (isSuccess) {
     $('mybtn).removeClass('disabled');
     }
     });
    });

    Please note that there are fundamental flaws to this approach: if your grid becomes paginated (there is more than one page), this will only look at the visible page. This means that if you have sorting enabled, they can intentionally sort to hide the "No" responses" and enable the button.

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

Announcing our 2025 Season 2 Super Users!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 2

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 2

#3
surya narayanan Profile Picture

surya narayanan 35