Can we Add color in Grid Field row data?

Hello All,

Can i able to add color to Grid field row data 



Thanks,

Shubham

  Discussion posts and replies are publicly visible

Parents
  • If you mean background colour, then no. But you could use a rich text field to colour the text itself. Beware: some colours work better than others.

    Here's an example:

    a!gridColumn(
            label: "Salary",
            sortField: "salary",
            value: a!richTextDisplayField(
              value: a!richTextItem(
                text: fv!row.salary,
                color: if(
                  fv!row.salary>39999,
                  "#ff0000",
                  "#008000"
                )
              )
            ),
            align: "END"
          )

    (note: you'd want to hold the literals used here - 39999, #ff0000 and #008000 in constants for maintenance and readability purposes)

Reply
  • If you mean background colour, then no. But you could use a rich text field to colour the text itself. Beware: some colours work better than others.

    Here's an example:

    a!gridColumn(
            label: "Salary",
            sortField: "salary",
            value: a!richTextDisplayField(
              value: a!richTextItem(
                text: fv!row.salary,
                color: if(
                  fv!row.salary>39999,
                  "#ff0000",
                  "#008000"
                )
              )
            ),
            align: "END"
          )

    (note: you'd want to hold the literals used here - 39999, #ff0000 and #008000 in constants for maintenance and readability purposes)

Children