1

I am modifying the Allitems view of a list and want to select each row with a specific title and change the last cell of that row to show the thumbnail of an image with jquery.

var results = data.d.results;
for (var i = 0; i < results.length; i++) {
    $("tr.ms-vb").filter(":contains('" + results[i].Title + "')").each(function() {
        $("td.ms-vb-lastCell").append($("<img>").prop("websitelink/_t/" + results[i].Title + "_jpg.jpg"))
    });

it make no changes or even errors.I have tried different classes for the selector, but none of them worked. does someone has any idea that what is wrong?

1

Since 2010 you can stuff HTML in a Calculated Column,

so if I read your use-case correct you need the Formula:

=IF( FIND("needle",[Title]) , "<img src='websitelink/_t/" & [Title] & ".jpg'/>" )

For testing make it output as text to see if the created HTML is correct

Then switch the datatype to Number!!! ét voila (that's French) it works..

Remember: FIND is Case-Sensitive, use SEARCH if you do not care about the CaSe. More SP functions at http://viewmaster365.com/365coach/#/Calculated_Column_Functions_List

  • I have tried the following in a new column as formula: =IF( FIND( [Title] , "<img src='websitelink/_t/" & [Title] & "_jpg.jpg'/>" , "no Image")) but it is not supported! i assume it is not supported for images. – Adi Oct 26 '15 at 8:48
  • Its working now, Thanks @Danny . I had to choose numbers as data type returned. – Adi Oct 26 '15 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.