You are viewing limited content. For full access, please sign in.

Question

Question

I would like to highlite a row in a table if a value of a column matches certain critaria

asked on November 17, 2017 Show version history

I have a table populated by a SQL lookup.  Each column is a Number column.  I would like each row in the table that meets the following criteria to be highlighted in yellow:

OP=10 and STD <.20   or    >2.00

 

I copied from another form I used when someone helped me in the past with scripting.  And I tried to modify it to do what I am looking for.  However,  I evidently don't know enough to modify it for my requirements.

(document).ready(function () {
    $('.cf-table-block').on('blur', 'input', sumtotal);
    {
        var sum = 0;
        $('.cf-table-block tbody tr').each(function () {
            var s = 0;
            o = parseNumber($(this).find('.OP input').val()) 
            s = parseNumber($(this).find('.STD input').val());
            $(this).find('.subtotal input').val(s);
            if ((o = 10) && (s > 2)) {
                $(this).closest('tr').css("background", "yellow");
            }
            else {
                $(this).closest('tr').css("background", "none");
            }
        });
    }
  
    function parseNumber(n) {
        var f = parseFloat(n); //Convert to float number.
        return isNaN(f) ? 0 : f; //treat invalid input as 0;
    }
});

 

Thank you for any help you can provide.

0 0

Answer

SELECTED ANSWER
replied on November 17, 2017

I got help with a similar question a few years ago.  Check out the thread here.

https://answers.laserfiche.com/questions/68942/Within-a-table-change-color-of-row-based-on-dropdown-field

1 0

Replies

replied on November 20, 2017

Thank you for the lead.  That helped us to finally achieve our goal.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.