• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Basic Template</title>
      <script nonce="undefined" src="https://cdn.zinggrid.com/dev/zinggrid-dev.min.js"></script>
      <style>
        body {
          background: #e6e6e6;
        }
    
        select {
          margin-bottom: 1rem;
        }
    
        zing-grid[loading] {
          height: 213px;
        }
      </style>
    </head>
    
    <body>
    
      <h3>`[rowDetailsRenderer]` points to a function that renders for the zg-row-details component.</h3>
    
      <zing-grid row-details-renderer="rowDetailsRenderer" data='[
          { "first": "Maria", "last": "John", "tests": [{"test1": 0.92, "test2": 0.97 ,"test3": 0.84}] },
          { "first": "David", "last": "Smith", "tests":  [{"test1": 0.86, "test2": 0.79, "test3": 0.86}] },
          { "first": "Felicity", "last": "Snow", "tests": [{"test1": 0.84, "test2": 0.66, "test3": 0.76}] }
        ]'>
        <zg-colgroup>
          <zg-column index="first"></zg-column>
          <zg-column index="last"></zg-column>
        </zg-colgroup>
      </zing-grid>
    
      <script>
        ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']); // window:load event for Javascript to run after HTML
        // because this Javascript is injected into the document head
        window.addEventListener('load', () => {
          // Javascript code to execute after DOM content
          let rowDetailsRenderer = (record, oDOMRowDetails) => {
            const nestedGrid = document.createElement('zing-grid');
            nestedGrid.data = record.tests;
            return nestedGrid;
          };
          ZingGrid.registerMethod(rowDetailsRenderer);
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Basic Template</title>
      <script src="https://cdn.zinggrid.com/dev/zinggrid-dev.min.js"></script>
    </head>
    
    <body>
    
      <h3>`[rowDetailsRenderer]` points to a function that renders for the zg-row-details component.</h3>
    
      <zing-grid row-details-renderer="rowDetailsRenderer" data='[
          { "first": "Maria", "last": "John", "tests": [{"test1": 0.92, "test2": 0.97 ,"test3": 0.84}] },
          { "first": "David", "last": "Smith", "tests":  [{"test1": 0.86, "test2": 0.79, "test3": 0.86}] },
          { "first": "Felicity", "last": "Snow", "tests": [{"test1": 0.84, "test2": 0.66, "test3": 0.76}] }
        ]'>
        <zg-colgroup>
          <zg-column index="first"></zg-column>
          <zg-column index="last"></zg-column>
        </zg-colgroup>
      </zing-grid>
    
    </body>
    
    </html>
    body {
      background: #e6e6e6;
    }
    
    select {
      margin-bottom: 1rem;
    }
    // window:load event for Javascript to run after HTML
    // because this Javascript is injected into the document head
    window.addEventListener('load', () => {
      // Javascript code to execute after DOM content
      let rowDetailsRenderer = (record, oDOMRowDetails) => {
        const nestedGrid = document.createElement('zing-grid');
        nestedGrid.data = record.tests;
        return nestedGrid;
      };
      ZingGrid.registerMethod(rowDetailsRenderer);
    });