• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="utf-8">
        <title>ZingGrid: Blank Grid</title>
        <script src="https://cdn.zinggrid.com/dev/zinggrid-dev.min.js" defer></script>
        <style>
            body {
                background: #e6e6e6;
            }
    
            .yellow {
                background: #fff59d;
            }
    
            .red {
                background: #ef9a9a;
            }
    
            zing-grid[loading] {
                height: 552px;
            }
        </style>
    </head>
    
    <body>
        <!-- Most features can be toggled on the toplevel zing-grid tag -->
        <zing-grid caption="Cell Class Function" col-class="singleColumnClass" 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>
            function singleColumnClass(index, cellDOMRef, cellRef) {
                if (index === 'name') 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" defer></script>
      </head>
      <body>
        <!-- Most features can be toggled on the toplevel zing-grid tag -->
        <zing-grid
          caption="Cell Class Function"
          col-class="singleColumnClass"
          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 singleColumnClass(index, cellDOMRef, cellRef) {
      if (index === 'name') return 'yellow';
      return 'red';
    }