Skip to main content
gautams4173
Known Participant
May 22, 2023 6:07 AM UTC
Solved

Highlight a row in Grid

Hi,

I am using a gridField ... Now I want to highlight a row based on a value of a particular value ..

say suppose I am displaying employee info (id, name, salary, location etc ) ... Now I want to highlight a row where the employee id = 10 with red color ... 

Is it possible to do so ?     

harshitb6843
Brainy
May 22, 2023 6:27 AM UTC

You should be able to do it by passing the selection value and playing with some properties of the grid. 

a!localVariables(
  local!selection: 1,
  local!data: {
    { id: 1, label: "Harshit" },
    { id: 2, label: "HarshitBumb.com" },
    { id: 1, label: "AppianSpace.com" }
  },
  a!gridField(
    data: local!data,
    columns: {
      a!gridColumn(
        label: "ID",
        value: fv!row.id
      ),
      a!gridColumn(
        label: "Name",
        value: fv!row.label
      )
    },
    selectable: true,
    selectionStyle: "ROW_HIGHLIGHT",
    selectionValue: local!selection
  )
)

10 replies

stefanhelzle0001
Brainy
May 22, 2023 6:10 AM UTC

No. Grids do not support that. But you can show a red icon in that row.

harshitb6843
Brainy
May 22, 2023 6:27 AM UTC

You should be able to do it by passing the selection value and playing with some properties of the grid. 

a!localVariables(
  local!selection: 1,
  local!data: {
    { id: 1, label: "Harshit" },
    { id: 2, label: "HarshitBumb.com" },
    { id: 1, label: "AppianSpace.com" }
  },
  a!gridField(
    data: local!data,
    columns: {
      a!gridColumn(
        label: "ID",
        value: fv!row.id
      ),
      a!gridColumn(
        label: "Name",
        value: fv!row.label
      )
    },
    selectable: true,
    selectionStyle: "ROW_HIGHLIGHT",
    selectionValue: local!selection
  )
)

sanchitg0002
Inspiring
May 22, 2023 7:35 AM UTC

Also, set disableRowSelectionWhen to true.

aminw4267
Known Participant
Sep 23, 2024 8:55 PM UTC

+1 for this feature. 

Known Participant
Sep 24, 2024 1:14 PM UTC

This is an old discussion. Since release 23.3 it has been possible to set the backgroundColor of gridColumn()

aminw4267
Known Participant
Sep 24, 2024 5:21 PM UTC

is this also available at the row or cell level? 

prasantap0900
Participating Frequently
Sep 25, 2024 6:15 PM UTC