I have a list that I am using for a library check out. When a person populates the check out date field I want my row to be grayed out. The condition would be if a field contains "any" information. This will be a date field that will change when a person checks out book so it wont be static information. Do anyone know how to do this? Here is my script for doing this.
<script type="text/javascript">
SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function() {
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
OnPostRender: function(ctx) {
var statusColors = {
"" : '#98FB98',
"12/10/2019" : '#D3D3D3'
};
var rows = ctx.ListData.Row;
for (var i=0;i<rows.length;i++)
{
var status = rows[i]["Check_x0020_Out_x0020_Date"];
var rowId = GenerateIIDForListItem(ctx, rows[i]);
var row = document.getElementById(rowId);
row.style.backgroundColor = statusColors[status];
}
}
});
});
</script>