Announcement

Collapse
No announcement yet.

Conditional Background color in grid

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditional Background color in grid

    Hello Everyone,

    I have a grid with a field status. From it I want to format row color to red (ex) depend on status value. If 2 = red and if 1 = normal (no format)
    How to do that.

  • #2
    The only way is to go to the onrecord event and do the checking there. Then you are able to set the background of each field using the sc_ macro's. Here you can set foreground colour, background color and a lot of other properties. Unfortunately you cannot change the full row in a different colour at once. Would be a nice feature though.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Originally posted by aducom View Post
      The only way is to go to the onrecord event and do the checking there. Then you are able to set the background of each field using the sc_ macro's. Here you can set foreground colour, background color and a lot of other properties. Unfortunately you cannot change the full row in a different colour at once. Would be a nice feature though.
      I hope the next version can handle this

      Comment


      • #4
        Hi,

        the first time it wordked but with this code it does not work , my B! field is numeric.


        if ({B1} > 0 ) {
        sc_field_color("B1","#57821E");

        }


        Thanks in advance

        Erwin

        N.B. Is there also a way to chnage the backgroud color of that one field?

        Comment


        • #5
          Originally posted by etsoft View Post
          Hi,

          the first time it wordked but with this code it does not work , my B! field is numeric.


          if ({B1} > 0 ) {
          sc_field_color("B1","#57821E");

          }


          Thanks in advance

          Erwin

          N.B. Is there also a way to chnage the backgroud color of that one field?
          Use this way:
          PHP Code:
          if ({estado_documento}=='N'){
              
          sc_field_style({estado_documento}, 'red''''''''');
          } else if ({
          estado_documento}=='P') {
              
          sc_field_style({estado_documento}, 'olive''''''''');
          } else if ({
          estado_documento}=='S') {
              
          sc_field_style({estado_documento}, 'green''''''''');

          Reference: sc_field_style({My_Field}, "Background-Color", "Size", "Color", "Family", "Weight")
          /Giuseppe

          Professional Scriptcase Services
          Some Customers opinions

          Comment

          Working...
          X