color
3 TopicsColor Code SharePoint List cell based on Due Date and Status columns
I am using the Javascript (at the bottom) on my SP 2013 site to color code a Due Date field. This code as written, does just that. However, if the Status column for the list item is set to Completed, then the Due Date field should not have color.. What can I do to not add color to the Due Date field if there is no Due Date entered or if the Status column is set to Completed. The below code works for setting the Due Date colors: <script type="text/javascript"> SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function () { var statusFieldCtx = {}; statusFieldCtx.Templates = {}; statusFieldCtx.Templates.Fields = { //internal column name between double quotes on the next line. If your column name has a space in its internal name use "_x0020_" in place of the space. "DueDate": { "View": ColorCodeDueDate } }; SPClientTemplates.TemplateManager.RegisterTemplateOverrides(statusFieldCtx); })(); function ColorCodeDueDate(ctx) { //update internal column name at the end of the next line var MyDateVar = new Date(ctx.CurrentItem.DueDate); MyDateVar.setHours(0,0,0,0); var today = new Date(); today.setHours(0,0,0,0); var then1 = new Date(); //use this to set how many days you want var then to be. then1.setHours(0,0,0,0); then1.setDate(then1.getDate() + 1); var then14 = new Date(); then14.setHours(0,0,0,0); //use this to set how many days you want var then to be. then14.setDate(then14.getDate() + 14); var then15 = new Date(); then15.setHours(0,0,0,0); //use this to set how many days you want var then to be. then15.setDate(then15.getDate() + 15); // if there's no due date don't render anything. Also update the column names in the else statements below. If your column name has a space in its internal name use "_x0020_" in place of the space. if (MyDateVar <= today) { return "<div style='background-color:red;color:white'>" + ctx.CurrentItem.DueDate + "</div>"; } else if (MyDateVar.getTime() >= then1.getTime() && MyDateVar.getTime() <= then14.getTime()) { return "<div style='background-color:yellow;color:black'>" + ctx.CurrentItem.DueDate + "</div>"; } else if (MyDateVar >= then15) { return "<div style='background-color:green;color:white'>" + ctx.CurrentItem.DueDate + "</div>"; } } </script>Solved4.3KViews0likes6CommentsSharePoint List color rows based upon date ranges relative to the Due Date
I would like to know how to color the rows on my SharePoint list. I have a Due Date column in my list Here is what I am looking to do: If Today's date is within 14 days of the Due Date then the entire row should be the color red If Today's date is between 15 days and 21 Days out from the Due Date, then the entire row color should be orange If Today's date is between 21 days and 30 days out from the Due Date, then the entire row should be yellow If Today's date is 31 days or more out from the Due Date, then the entire row should be Green I am assuming I will be using Client Side Rendering (I don't know I am guessing). 1. What files will I need to create (a .txt file or a .txt file that is converted to a .js file? 2. Will I have to use Content Editor Web Part to refernece the .txt or .js file?Solved26KViews0likes7CommentsDefault Main Calendar Color and Legend
Hi all, I am trying to change the Default Main calendar color. NOT the overlays, but the main calendar. I have tried doing some css coding with HTML Form Web Part, but i cant manage to get it right. You can see the main "SETA Calendar" is blue. We want it to be purple. Any ideas?1.8KViews0likes0Comments