Skip to main content

How to display SharePoint list item status values into images/icons using simple JavaScript


src="http://code.jquery.com/jquery-latest.min.js"

$(document).ready(
  function() {
    $('td.ms-vb2:contains("Completed"), ' +
      'td.ms-vb2:contains("Pending")').each(
        function() {
          $(this).hide();
          $(this).html(ReplaceColorTextWithImage($(this).html()));
          $(this).show("slow");
        }
    );
  }
);

function ReplaceColorTextWithImage(strColorText) {
  var strColorImage = "";

  switch(strColorText) {
    case "Completed":
      strColorImage = "green";
      break;
    case "Not Started":
      strColorImage = "Red";
      break;
  }

 return ""

}

 return "$$>";


Credit /Source
http://www.dalesandro.net/replace-text-with-images-in-sharepoint-view-using-jquery/
Using Jequery
https://www.sharepointusecases.com/2014/04/replacing-strings-icons-list-view-jquery-sharepoint-2010/

Comments

Popular posts from this blog

Printing Date Format in  Power Automate (Flows) I was trying to format print the date and found multiple ways to print Date perticularly Month for my requirements. please find various  Month Format  formatDateTime(triggerBody()?['Test_x0020_Date_x002F_Time'],'MM/dd/yyyy') Output 12 /11/2020  formatDateTime(triggerBody()?['Test_x0020_Date_x002F_Time'],'MMM/dd/yyyy')   Output  Dec /11/2020  formatDateTime(triggerBody()?['Test_x0020_Date_x002F_Time'],'MMM/dd/yyyy') Output    December /11/2020  Surce https://sharepains.com/2018/11/12/formatdatetime-flow-power-automate/     The formatting options for formatDateTime, that you can use here are listed in the following table. Any of the format specifiers can be used in any kind of combination. FORMAT SPECIFIER DESCRIPTION EXAMPLES “d” The day of the month, from 1 through 31. More information:  The “d” Custom Format Specifier . 2009-06-01T13:45:30 -> 1 2009-06-15T13:45:30 -> 15 “dd” The day o
Get Email User Name, email from SharePoint person field in list  you can get user name and email from person field is the group or person coloumn Create PersonGroupCol - person or group field If you are not going to use those email address values later (you don't need to save emails in column) and you just want to show the email in SharePoint list view then you can also achieve it using JSON column formatting. Create one single line of text column (Email, Name) Hide it from list forms (make it  Hidden  from content type settings). Then use below JSON code to format the column: { "$schema" : "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" , "elmType" : "div" , "txtContent" : "[$ PersonGroupCol . email ]" } For User Name { "$schema" : "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" , "elmType" : "div"

How to remove special characters from the SharePoint list column using calculated column - SharePoint online

Remove special characters  from the SharePoint list column using calculated column =REPLACE([FirstNameLastName],SEARCH(" & ",[FirstNameLastName]),0,"") or =IF(ISERR(SEARCH("&",Title,1)),Title,REPLACE(Title,SEARCH("&",Title,1),2,""))  Source https://social.technet.microsoft.com/Forums/sharepoint/en-US/42391d83-a6eb-480f-b84a-3d43ef4f5e40/calculated-column-to-remove-amp-and-space-quotamp-quot?forum=sharepointgeneralprevious https://social.technet.microsoft.com/Forums/office/en-US/74d8022b-03f4-4ccf-9bfc-a3075a2f9202/multiple-replace-on-calculated-column?forum=sharepointgeneralprevious