<!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: 525px; } </style> </head> <body> <!-- Most features can be toggled on the toplevel zing-grid tag --> <zing-grid caption="Row Class Function" row-class="rowClass" layout="row" layout-controls="disabled" viewport-stop> <!-- dataset --> <zg-data data='[ { "breed": "Cane Corso", "name": "Ziva"}, { "breed": "Pug", "name": "Doug"}, { "breed": "Corgi", "name": "Jenny"}, { "breed": "Pomeranian", "name": "Koda"}, { "breed": "Great Dane", "name": "Zeus"}, { "breed": "Frenchie", "name": "Bruce"}, { "breed": "Cane Corso", "name": "Sofia"}, { "breed": "Pomeranian", "name": "Snowball"} ]'></zg-data> </zing-grid> <script> ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']); function rowClass(record, index, cellDOMRef, cellRef) { if (index % 2) return 'yellow'; return 'red'; } </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="Row Class Function" row-class="rowClass" layout="row" layout-controls="disabled" viewport-stop> <!-- dataset --> <zg-data data='[ { "breed": "Cane Corso", "name": "Ziva"}, { "breed": "Pug", "name": "Doug"}, { "breed": "Corgi", "name": "Jenny"}, { "breed": "Pomeranian", "name": "Koda"}, { "breed": "Great Dane", "name": "Zeus"}, { "breed": "Frenchie", "name": "Bruce"}, { "breed": "Cane Corso", "name": "Sofia"}, { "breed": "Pomeranian", "name": "Snowball"} ]'></zg-data> </zing-grid> </body> </html>
body { background: #e6e6e6; } .yellow { background: #fff59d; } .red { background: #ef9a9a; }
function rowClass(record, index, cellDOMRef, cellRef) { if (index % 2) return 'yellow'; return 'red'; }