Having trouble formatting attribute as hyperlink in find task results table. can someone give me a hand with this?
Ryan,
Sure you just need to build your HTML Anchor element (line 23):
//loop through each result in the response and add as a row in the table arrayUtils.forEach(response, function(findResult, i) { //Get each value of the desired attributes var subname = findResult.feature.attributes.NAME; var bookpage = findResult.feature.attributes[ "BOOKANDPAGE"]; var link = findResult.feature.attributes[ "WEBURL"]; var editor = findResult.feature.attributes[ "EDITORNAME"]; var date = findResult.feature.attributes[ "last_edited_date"]; //Add each resulting value to the table as a row var row = resultsTable.insertRow(i + 1); var cell1 = row.insertCell(0); var cell2 = row.insertCell(1); var cell3 = row.insertCell(2); var cell4 = row.insertCell(3); var cell5 = row.insertCell(4); cell1.innerHTML = subname; cell2.innerHTML = bookpage; cell3.innerHTML = "<a href=\"" + link + "\" target=\"_blank\">Web Link</a>"; cell4.innerHTML = editor; cell5.innerHTML = date; });
Thanks Robert!
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.