• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Docs Getting Started</title>
      <!--Script Reference[1]-->
      <script nonce="undefined" src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
      <style>
        zing-grid[loading] {
          height: 172px;
        }
      </style>
    </head>
    
    <body>
      <!--Grid Component Placement[2]-->
      <zing-grid caption="Data HTML Attribute Assignment" sort search layout="row" viewport-stop>
      </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', () => {
          // content after DOM load
          const zgRef = document.querySelector('zing-grid');
          const data = [{
              name: 'Philip J. Fry',
              origin: 'Earth',
            },
            {
              name: 'Turanga Leela',
              origin: 'Earth',
            },
            {
              name: 'Bender Bending Rodriguez',
              origin: 'Earth',
            },
            {
              name: 'Amy Wong',
              origin: 'Mars',
            },
            {
              name: 'Doctor John Zoidberg',
              origin: 'Decapod 10',
            },
            {
              name: 'Lord Nibbler',
              origin: 'Earth',
            }
          ];
          zgRef.setAttribute('data', JSON.stringify(data));
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Docs Getting Started</title>
      <!--Script Reference[1]-->
      <script src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
    </head>
    
    <body>
      <!--Grid Component Placement[2]-->
      <zing-grid caption="Data HTML Attribute Assignment" sort search layout="row" viewport-stop>
      </zing-grid>
    </body>
    
    </html>
    
          
    // window:load event for Javascript to run after HTML
    // because this Javascript is injected into the document head
    window.addEventListener('load', () => {
      // content after DOM load
      const zgRef = document.querySelector('zing-grid');
      const data = [{
          name: 'Philip J. Fry',
          origin: 'Earth',
        },
        {
          name: 'Turanga Leela',
          origin: 'Earth',
        },
        {
          name: 'Bender Bending Rodriguez',
          origin: 'Earth',
        },
        {
          name: 'Amy Wong',
          origin: 'Mars',
        },
        {
          name: 'Doctor John Zoidberg',
          origin: 'Decapod 10',
        },
        {
          name: 'Lord Nibbler',
          origin: 'Earth',
        }
      ];
      zgRef.setAttribute('data', JSON.stringify(data));
    });