none
custom row highlight issues on refresh RRS feed

  • Question

  • So I have a little script running on an o365 sp list,

    It works perfectly unless someone refreshes a filtered list,

    I assume because of the filter screwing up the RowId?

    is there an EASY way to fix this?

    <script>
    SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function() {

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
    OnPostRender: function(ctx) {

    var statusColors = {
    'Level 0' : 'rgba(255, 0, 0, 0.25)', 
    'Level 1' : 'rgba(255, 165, 0, 0.5)'

    };

    var rows = ctx.ListData.Row;
    for (var i=0;i<rows.length;i++)
    {
    var status = rows[i]["Catagorization"];
    var rowId = GenerateIIDForListItem(ctx, rows[i]);
    var row = document.getElementById(rowId); 
    row.style.backgroundColor = statusColors[status];
    }
    ctx.skipNextAnimation = true;
    }
    });

    });</script>

    Monday, August 19, 2019 12:01 PM

All replies

  • Hi, 

    Could you provide more details for this.

    I did test in my online environment while it’s working fine.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, August 20, 2019 2:04 AM