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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Portal & JQuery - "loaded" event not firing for EntityList

(0) ShareShare
ReportReport
Posted on by 75

I am beginning to customize EntityLists with JQuery. I am using the basic example provided by Microsoft here.

I've added the following code to my EntityList in the "Custom Javascript" section of the Options tab. 

$(document).ready(function (){
  $(".entitylist.entity-grid").on("loaded", function () {
    $(this).children(".view-grid").find("tr").each(function (){
      // do something with each row
      $(this).css("background-color", "yellow");
    });
  });
}); 

The event is not firing when the page loads. I have tried this in multiple browsers.

I added alerts and logs to various places to see where it's failing. The $(document).ready()  fires successfully, but the EntityList .on("loaded") does not. I can see in the browser debugger that the event is registered.

jqevent.png

To verify that the issue is not with the code inside the function, I changed the event to "click", and when I click on the EntityList, the code runs successfully.

Has anyone else had trouble with this event while customising Portals?
Am I missing something obvious here?

Thanks,
Tadhg.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Tadhg Profile Picture
    75 on at

    Resolved this by removing the $(document).ready().
    The code that works:

    $(".entitylist.entity-grid").on("loaded", function () {
        $(this).children(".view-grid").find("tr").each(function (){
            // do something with each row
            $(this).css("background-color", "yellow");
        });
    });


    I hope this helps someone else

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans