<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingGrid: Blank Grid</title> <script nonce="undefined" src="https://cdn.zinggrid.com/dev/zinggrid-dev.min.js"></script> <style> body { background: #e6e6e6; } .yellow { background: #fff59d; } .red { background: #ef9a9a; } zing-grid[loading] { height: 592px; } </style> </head> <body> <!-- Most features can be toggled on the toplevel zing-grid tag --> <zing-grid caption="Head Class Function" head-class="highlightHeadCells" layout="row" layout-controls="disabled" viewport-stop> <!-- dataset --> <zg-data data='[ { "breed": "Cane Corso", "name": "Ziva", "points": 15}, { "breed": "Pug", "name": "Doug", "points": 3}, { "breed": "Corgi", "name": "Jenny", "points": 4}, { "breed": "Pomeranian", "name": "Koda", "points": 8}, { "breed": "Great Dane", "name": "Zeus", "points": 11}, { "breed": "Frenchie", "name": "Bruce", "points": 6}, { "breed": "Cane Corso", "name": "Sofia", "points": 2}, { "breed": "Pomeranian", "name": "Snowball", "points": 7} ]'></zg-data> <zg-colgroup> <zg-column index="breed"></zg-column> <zg-column index="name"></zg-column> <zg-column index="points" foot-cell="avg" type="number"></zg-column> <zg-column index="points" foot-cell="min" type="number"></zg-column> <zg-column index="points" foot-cell="max" type="number"></zg-column> </zg-colgroup> </zing-grid> <script> ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']); function highlightHeadCells(columnIndex, cellDOMRef, columnRef) { if (columnIndex === 'points') return 'yellow'; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingGrid: Blank Grid</title> <script src="https://cdn.zinggrid.com/dev/zinggrid-dev.min.js"></script> </head> <body> <!-- Most features can be toggled on the toplevel zing-grid tag --> <zing-grid caption="Head Class Function" head-class="highlightHeadCells" layout="row" layout-controls="disabled" viewport-stop> <!-- dataset --> <zg-data data='[ { "breed": "Cane Corso", "name": "Ziva", "points": 15}, { "breed": "Pug", "name": "Doug", "points": 3}, { "breed": "Corgi", "name": "Jenny", "points": 4}, { "breed": "Pomeranian", "name": "Koda", "points": 8}, { "breed": "Great Dane", "name": "Zeus", "points": 11}, { "breed": "Frenchie", "name": "Bruce", "points": 6}, { "breed": "Cane Corso", "name": "Sofia", "points": 2}, { "breed": "Pomeranian", "name": "Snowball", "points": 7} ]'></zg-data> <zg-colgroup> <zg-column index="breed"></zg-column> <zg-column index="name"></zg-column> <zg-column index="points" foot-cell="avg" type="number"></zg-column> <zg-column index="points" foot-cell="min" type="number"></zg-column> <zg-column index="points" foot-cell="max" type="number"></zg-column> </zg-colgroup> </zing-grid> </body> </html>
body { background: #e6e6e6; } .yellow { background: #fff59d; } .red { background: #ef9a9a; }
function highlightHeadCells(columnIndex, cellDOMRef, columnRef) { if (columnIndex === 'points') return 'yellow'; }