Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Can someone assist with Javascript to test a vield value

I am trying to add a css style and need to test if the field value in the grid is greater than or less than zero. What is the correct way to write this. The field name is Balance and its data type is money. Is it: [Balance] > 0
1 person has
this question
+1
Reply
  • If you're doing in the test in the "Styles" option of the gird then the syntax for the test will be something like $row.Balance > 0
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Hi Peter

    Thanks for the assistance, thats exactly where I am trying to do this. I tried it but no luck. I havn't set the colours in the css yet which I will do when I get this to work. What I have in my css file is below.

    Steve



  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Hi Steve,

    I can easily change the ROW background colour of a view, but I've never been able to satisfactorily change the CELL background colour.

    I'm not sure but I think this is due to the large variation in cell properties between view styles.

    Instead of trying to change the cell background colour I use other resources such as icons and shapes.
    I find they look more elegant than a whole cell background colour.
    Of course, you may not agree, but I've included my process just in case.

    First I create a custom style sheet in the CSS folder called "StyleSheet.css"...



    Second I add the CSS code to this file...



    Then I add the property that makes it work in the Style section of my view...



    Here's the result...



    Hope this helps,

    Jonesy
    • Hi Jonesy
      I see what you mean about "more elegant". Roberto's solution below worked perfectly but as I mentioned in my response to him one of my colours needs to be black so a red flag and a black flag along with a calculated field to display the equivalent values of your Moderate and Severe worked perfectly and presents very well on screen. Thanks again.
      Steve
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • 1
    Hi, all:

    To change the cell background color


    .alert-yellow .app-field-Date {
    background-color: lightyellow !important;
    }


    Best regards,

    Roberto
    • view 1 more comment
    • Roberto, so this CSS is in your stylesheet, correct? Then is this a system-wide change for the field named "Date"?
      I don't see how this ties in to a specific cell on a given grid? Could you expand how to implement this please... for a newbie? thx
    • Jaymar,

      The css classes are "system wide", but you control when the classes are tagged on a controller by controller basis because of the specific class naming. In my example only fields named "Date" are affected.

      Best regards,

      Roberto
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Cheers Roberto and Jonesy, I love the flag idea and I, like others, have never yet been able to set a single field's background.

    Peter
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Try something like this:

    tr.RedA td.A
    {
    color: white!important;
    font-weight: bold!important;
    background-color: red!important;
    }

    RedA is a style name. A is a field name.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited