
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.
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)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