1

I'm wondering if there is a way to manually highlight a SharePoint list cell, without needing to use conditional formatting.

The reason for this is that there isn't a strict rule in order to highlight a cell, it needs to be a decision made by the user. For example, if a date is 'Fixed' rather than 'flexible' they could highlight that date.

In theory I could add an extra column to highlight flexible or fixed but this would become quite messy as there are already numerous date columns and each would require the extra column.

Ideally it would just be a toggle (like in word or excel) when you enter text to have it in bold, italics etc. I don't believe that exists though!

Any help would be greatly appreciated.

2 Answers 2

1

You cannot manually set the "Highlight line" for SharePoint list cell. However, you could using jquery to achieve your design.

Please follow steps:

1.Create a Choice column named "Condition"

enter image description here

2.Download the Highlight.js and upload to SharePoint Site Assets Library.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">

(function() {  
    var overrideCurrentContext = {};  
    overrideCurrentContext.Templates = {};  
    overrideCurrentContext.OnPostRender = HighlightProductRows;  
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCurrentContext);  
})();  
  
  
function HighlightProductRows(ctx) {  
    var statusColors = {  
        'Fixed': '#FAF304',  
        'Flexible': '#FFFFFF'
    };  
  
    var rows = ctx.ListData.Row;  
    for (var i = 0; i < rows.length; i++) {  
        var status = rows[i]["Condition"];  
        var rowId = GenerateIIDForListItem(ctx, rows[i]);  
        var row = document.getElementById(rowId);  
        row.style.backgroundColor = statusColors[status];  
    }  
} 

</script>

3.Switch to classic mode, click "Edit page" under the settings menu.

4.Add a Content Editor web part.

5.Select the Content Editor web part and click Edit Web Part. Copy the uploaded Highlight.js link to the "To link to a text file, type a URL" textbox.

enter image description here

  1. Apply and Stop Edit.

enter image description here

======================== Updated Answer ======================

Please use the following script:

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">

(function() {  
    var overrideCurrentContext = {};  
    overrideCurrentContext.Templates = {};  
    overrideCurrentContext.OnPostRender = HighlightProductRows;  
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCurrentContext);  
})();  
  
  
function HighlightProductRows(ctx) {  
    var statusColors = {  
        'Fixed': '#FAF304',  
        'Flexible': '#FFFFFF'
    };  
  
    var rows = ctx.ListData.Row;  
    for (var i = 0; i < rows.length; i++) {  
        var status = rows[i]["Condition"];  
        var rowId = GenerateIIDForListItem(ctx, rows[i]);  
        var row = document.getElementById(rowId);
        row.style.backgroundColor = "#FFFFFF";
        var cell = row.cells[5];//Replace 5 with your columns cell number
        cell.style.backgroundColor = statusColors[status];  
    }  
} 

</script>

enter image description here

4
  • Thank you very much for looking into that for me! The only issue with that solution is that I would need to fill in the entire row and it's just based on one date whereas my list will have multiple dates and any one of them could be fixed/flexible. I think it does make sense having a condition/status column though to mark fixed or flexible and then I can just hide those. Would it be possible to highlight just the date cell if the corresponding condition cell is fixed? Eg. Release Date Condition 5/1/1991 (highlighted) Fixed Thanks again! Commented Jan 22, 2021 at 16:30
  • Hi, lozzeroooni. Thanks for your reply. I have updated my answer, hope this can help your. Commented Jan 25, 2021 at 7:40
  • Thank you so much for your help! Commented Jan 27, 2021 at 13:17
  • Hi, lozzeroooni. Glad I can help you to slove issue. Have a nice day! Commented Jan 28, 2021 at 0:47
0

Currently there is no way to manually highlight the cell in SharePoint online list like word or excel.

2
  • Thought so, thank you Ganesh. Do you know if there might be another way to get around this? Commented Jan 21, 2021 at 17:24
  • I don't think there is any way to manage it at cell level and highlight only particular cells manually. Commented Jan 21, 2021 at 17:34

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.