0

I need a script to highlight rows in a SP 2013 List if one field is null/empty.

Any help is appreciated!

Field: [Date Funded]

Thanks-

2
  • 1
    You can use Client side rendering/JS Link to highlight row based on column value. Check my answer given here. Commented May 18, 2020 at 15:45
  • Ganesh! Thank you! To check for a null or empty value, would I use: varDate = {' ': '#color', ?
    – ChasEpes
    Commented May 18, 2020 at 15:49

1 Answer 1

1

You can use Client side rendering/JS Link to highlight row based on column value. Similar to my answer given here.

Try something like below:

SP.SOD.executeFunc("clienttemplates.js", 
"SPClientTemplates", function() {
SPClientTemplates.TemplateManager.
RegisterTemplateOverrides({
  OnPostRender: function(ctx) {
     var rows = ctx.ListData.Row;
     for (var i=0;i<rows.length;i++)
     {
         var dateFunded = rows[i]["DateFunded"]; // use internal name of your column here
         var rowId = GenerateIIDForListItem(ctx, rows[i]);
         var row = document.getElementById(rowId); 
         if(!dateFunded) {
             row.style.backgroundColor = "#FF0000"; //Red color
         } 
     }
   }
}); 
});

Reference:

Find the internal name of SharePoint column

1
  • 1
    Thank you again Ganesh. This is perfect- Have a good & safe day-
    – ChasEpes
    Commented May 18, 2020 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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