Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

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

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

  • Verified answer
    Tadhg Profile Picture
    Tadhg 75 on at
    RE: Portal & JQuery - "loaded" event not firing for EntityList

    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans