Hi all,
An entity list will pop up to show all the related entity records by click a search button of a lookup field. How can I fire javascript when the list is loaded to manipulate the value of name column? I try this
$(document).ready(function () { $("#EntityListControl").on("loaded", function () { alert("Yes!"); // $('#EntityListControl td').filter(function () { // return this.textContent === "SYSTEM" // }).css("color", "red"); }); $(".entitylist.entity-grid").on("loaded", function () { alert("Yes!"); }); });
But it doesn't work. No alert pops up when the list pops up. Can anyone help?
Thank you very much, Leo!
I used JQuery to register the handler to the click event, searching for the table row count change. And it worked. The only problem is the selector is so ugly:
$("#ProfileFormView > div.tab.clearfix > div > div > fieldset > table > tbody > tr:nth-child(3) > td.clearfix.cell.lookup.form-control-cell > div.control > div.input-group > div > button.btn.btn-default.launchentitylookup").click(function () {
I also tried the method you mentioned, and it worked. The problem is that if I click next on the lookup list to get another page of records, how can I capture the event?
My goal is to present the right content of English or French based on if the browser url contains "en-US" or "fr-FR".
Hi partner,
You could add your action code into the following code, and add all the code into entity form->"Additional Settings->Custom JavaScript".
$(document).ready(function () { $(".genericContact").parent().find("button[title='Launch lookup modal']").each(function () {//click for all lookup $(this).click(function () { //your code here }); }); });
This code will be triggered when you click on the search icon beside lookup field, and then you could add a "setTimeout" to run your code until the pop up window loaded.
I used the custom css selector "genericContact" in my code, so you need to add it into form first, go to Entity Form->Entity Form Metadata, add a new record and select your lookup attribute.
Fill in the custom style in "Css Class".
You could also refer to the following links.
https://www.cloudfronts.com/add-a-css-class-to-a-field-on-entity-form-on-dynamics-365-portals/
Best Regards,
Leo
Muhammad Shahzad Sh...
51
Most Valuable Professional
Ramesh Kumar
42
David Shaw_UK
27