• Edit
  • Download
  • <!DOCTYPE html>
    <html class="zg-html">
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Blank Grid</title>
      <script nonce="undefined" src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
      <style>
        body {
          background: #e6e6e6;
        }
    
        #result {
          background: #333232;
          color: white;
          font-family: monospace;
          margin-bottom: 2rem;
          padding: 1rem;
        }
    
        zing-grid[loading] {
          height: 357px;
        }
      </style>
    </head>
    
    <body class="zg-body">
      <h3>`[updateRowMethod]` set request method for editing a row.</h3>
      <div id="result">N/A</div>
      <zing-grid editor-controls="editor">
        <zg-data src="https://us-central1-zingsoft-demo-endpoints.cloudfunctions.net/zingsoft-parammethod/api">
          <zg-param name="updateRowMethod" value="post"></zg-param>
        </zg-data>
      </zing-grid>
    
      <script>
        ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']);
        const zgRef = document.querySelector('zing-grid');
    
        let oldFetch = window.fetch;
        window.fetch = function(fetchUrl, requestObj) {
          return new Promise((resolve, reject) => {
            oldFetch.apply(this, arguments)
              .then((response) => {
                // Get request method and url
                if (requestObj.method === 'POST') {
                  result.textContent = `UPDATE ROW REQUEST: ${requestObj.method} ${fetchUrl}`;
                }
                oldFetch.call(this, fetchUrl, requestObj);
                resolve(response);
              })
              .then((data) => {
                if (data) window.fetch = oldFetch;
              })
              .catch((error) => {
                reject(error);
              });
          });
        };
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html class="zg-html">
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Blank Grid</title>
      <script src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
    </head>
    
    <body class="zg-body">
      <h3>`[updateRowMethod]` set request method for editing a row.</h3>
      <div id="result">N/A</div>
      <zing-grid editor-controls="editor">
        <zg-data src="https://us-central1-zingsoft-demo-endpoints.cloudfunctions.net/zingsoft-parammethod/api">
          <zg-param name="updateRowMethod" value="post"></zg-param>
        </zg-data>
      </zing-grid>
    
    </body>
    
    </html>
    body {
      background: #e6e6e6;
    }
    
    #result {
      background: #333232;
      color: white;
      font-family: monospace;
      margin-bottom: 2rem;
      padding: 1rem;
    }
    const zgRef = document.querySelector('zing-grid');
    
    let oldFetch = window.fetch;
    window.fetch = function(fetchUrl, requestObj) {
      return new Promise((resolve, reject) => {
        oldFetch.apply(this, arguments)
          .then((response) => {
            // Get request method and url
            if (requestObj.method === 'POST') {
              result.textContent = `UPDATE ROW REQUEST: ${requestObj.method} ${fetchUrl}`;
            }
            oldFetch.call(this, fetchUrl, requestObj);
            resolve(response);
          })
          .then((data) => {
            if (data) window.fetch = oldFetch;
          })
          .catch((error) => {
            reject(error);
          });
      });
    };