• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid Demo</title>
      <script nonce="undefined" src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
      <style>
        body {
          background: #e6e6e6;
        }
    
        zing-grid[loading] {
          height: 450px;
        }
      </style>
    </head>
    
    <body>
      <zing-grid caption="Movies" preserve-state-id="featuresGridState4" columns-control column-drag filter="both" layout-controls pager page-size="4" page-size-options="2,4,10,20" search sort src="https://zinggrid-examples.firebaseio.com/movies/">
      </zing-grid>
      <script>
        ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']);
        window.addEventListener('load', () => {
          let sortState = {
            "sort": {
              "index": "director",
              "order": 1
            }
          };
          let zgRef = document.querySelector('zing-grid');
          zgRef.executeOnLoad(() => {
            zgRef.setState(sortState);
            // alternatively
            // zgRef.setStateField('sort', sortState.sort);
          });
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid Demo</title>
      <script src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
    </head>
    
    <body>
      <zing-grid caption="Movies" preserve-state-id="featuresGridState4" columns-control column-drag filter="both" layout-controls pager page-size="4" page-size-options="2,4,10,20" search sort src="https://zinggrid-examples.firebaseio.com/movies/">
      </zing-grid>
    </body>
    
    </html>
    body {
      background: #e6e6e6;
    }
    window.addEventListener('load', () => {
      let sortState = {
        "sort": {
          "index": "director",
          "order": 1
        }
      };
      let zgRef = document.querySelector('zing-grid');
      zgRef.executeOnLoad(() => {
        zgRef.setState(sortState);
        // alternatively
        // zgRef.setStateField('sort', sortState.sort);
      });
    });