Skip to main content
gautams4173
May 22, 2023
Solved

Highlight a row in Grid

  • May 22, 2023
  • 10 replies
  • 1 view

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 ?     

Best answer by harshitb6843

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
May 22, 2023

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

harshitb6843
May 22, 2023

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
  )
)

May 22, 2023

Also, set disableRowSelectionWhen to true.

aminw4267
September 23, 2024

+1 for this feature. 

September 24, 2024

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

aminw4267
September 24, 2024

is this also available at the row or cell level? 

prasantap0900
September 25, 2024