1

I want to highlight child rows in different color using CSS to differentiate parent/child rows.

PriyaN
  • 23
  • 4
  • See https://stackoverflow.com/questions/8768317/how-do-i-override-default-primefaces-css-with-custom-styles – Jasper de Vries May 20 '22 at 07:51
  • Sorry this link doesn't have solution for my question. I am unable to highlight child rows in different color with CSS. – PriyaN May 20 '22 at 20:13

1 Answers1

1

When you use your browser's DOM inspector, you'll notice that table rows (tr) of a p:treeTable are classed with ui-node-level-n. N is the level, starting at 1. So root items are level 1, children of level 1 are level 2 and so on. To have white root nodes and yellow child nodes, you can use the following CSS rules:

html body .ui-treetable .ui-treetable-data>tr {
    background: yellow;
}
body .ui-treetable .ui-treetable-data>tr.ui-node-level-1 {
    background: white;
}

See also:

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102