"Add color to a specific field value in a view." isn't working

Hi everyone,

I'm following the examples under support for "Add color to a specific field value in a view." to make a field on a form red when the value is "Need to Submit".

My values are:

Page_ID is scene_22

View_ID is view_29

"Request Status" field that contains the "Need to Submit" value is field_64

I don't see anywhere in the code where it asks for page ID or scene, so I have the code as follows:

// Your app's ViewID and FieldID will need updated.

$(document).on('knack-view-render.view_29', function(event, view, data) {

   

    $("#view_29 td.field_64").each(function() {

     

        var textColor = ($(this).find("span").text().trim() == "Need to Submit") ? "#ff0000" : "#1c631f"; // #ff0000 is red and the #1c631f is green

     

        $(this).css("color", textColor);

   

    })

 

});

This doesn't work though the text just stays black.  I'm not entirely clear how the colours work in terms of when it goes red or green like in the example, so left it at default just to see what it does but no matter what I try it never changes the colour from black.  Am I missing something?

 Hello,

Instead of " $("#view_29 td.field_64").each(function() {"

can you try " $("#view_29").find("td.field_64").each(function() {"

Hi Lee

Did the team get back to you on this? I am having precisely the same problem.

I'm wondering if there is an error in the example, but as jquery isn't my strong point I can't be sure.

Would appreciate a steer.

Thanks

 

Mike Moore