• Edit
  • Download
  • <!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;
        }
    
        .breed {
          background: #fff59d;
        }
    
        .cane-corso {
          background: #ef9a9a;
        }
    
        .pomeranian {
          background: #90caf9;
        }
    
        .name {
          font-family: Roboto;
        }
    
        .ziva {
          font-size: 2rem;
        }
    
        .koda {
          font-size: 1.3rem;
        }
    
        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" 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>
    
        <!-- define custom columns -->
        <zg-colgroup>
          <zg-column index="breed" cell-class="singleIndex"></zg-column>
          <zg-column index="name, breed" cell-class="multipleIndices"></zg-column>
        </zg-colgroup>
      </zing-grid>
    
      <script>
        ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']);
    
        function singleIndex(breed, cellDOMRef, cellRef) {
          return `breed ${breed.replace(/\s+/g, '-').toLowerCase()}`;
        }
    
        function multipleIndices(name, breed, cellDOMRef, cellRef) {
          return `name ${name.toLowerCase()}`;
        }
      </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="Cell Class Function" 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>
    
        <!-- define custom columns -->
        <zg-colgroup>
          <zg-column index="breed" cell-class="singleIndex"></zg-column>
          <zg-column index="name, breed" cell-class="multipleIndices"></zg-column>
        </zg-colgroup>
      </zing-grid>
    
    </body>
    
    </html>
    body {
      background: #e6e6e6;
    }
    
    .breed {
      background: #fff59d;
    }
    
    .cane-corso {
      background: #ef9a9a;
    }
    
    .pomeranian {
      background: #90caf9;
    }
    
    .name {
      font-family: Roboto;
    }
    
    .ziva {
      font-size: 2rem;
    }
    
    .koda {
      font-size: 1.3rem;
    }
    function singleIndex(breed, cellDOMRef, cellRef) {
      return `breed ${breed.replace(/\s+/g, '-').toLowerCase()}`;
    }
    
    function multipleIndices(name, breed, cellDOMRef, cellRef) {
      return `name ${name.toLowerCase()}`;
    }