• 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>
        html,
        body {
          height: 100%;
          width: 100%;
          margin: 0;
          padding: 0;
        }
    
        zg-caption h1 {
          font-size: 2rem;
        }
    
        zg-caption p {
          font-size: 1rem;
        }
    
        zg-head {
          font-size: 1.3rem;
        }
    
        zing-grid[loading] {
          height: 445px;
        }
      </style>
    </head>
    
    <body>
      <h3>`ZGParam[filterFunction]` specifies a function to call to build the url for filtering on server side filter.</h3>
      <h3>`ZGColumn[filterKey]` sets the key for server-side filtering.</h3>
    
      <zing-grid filter="both" filter-menu-areas="both">
        <zg-colgroup>
          <zg-column index="id" filter-key="id-key"></zg-column>
          <zg-column index="name" filter-key="name-key"></zg-column>
          <zg-column index="job" filter-key="job-key"></zg-column>
        </zg-colgroup>
        <zg-data>
          <zg-param name="src" value="https://zingsoft-filter-function.glitch.me//api"></zg-param>
          <zg-param name="loadByPage" value="true"></zg-param>
          <zg-param name="serverFilter" value="true"></zg-param>
          <zg-param name="filterFunction" value="createFilterURL"></zg-param>
        </zg-data>
      </zing-grid>
    
      <script>
        ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']);
    
        function createFilterURL(oFilter) {
          // Keys should use values from `[filter-key]` instead of `[index]`
          console.log(oFilter);
          return `?filter=${encodeURIComponent(JSON.stringify(oFilter))}`;
        };
      </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>
      <h3>`ZGParam[filterFunction]` specifies a function to call to build the url for filtering on server side filter.</h3>
      <h3>`ZGColumn[filterKey]` sets the key for server-side filtering.</h3>
    
      <zing-grid filter="both" filter-menu-areas="both">
        <zg-colgroup>
          <zg-column index="id" filter-key="id-key"></zg-column>
          <zg-column index="name" filter-key="name-key"></zg-column>
          <zg-column index="job" filter-key="job-key"></zg-column>
        </zg-colgroup>
        <zg-data>
          <zg-param name="src" value="https://zingsoft-filter-function.glitch.me//api"></zg-param>
          <zg-param name="loadByPage" value="true"></zg-param>
          <zg-param name="serverFilter" value="true"></zg-param>
          <zg-param name="filterFunction" value="createFilterURL"></zg-param>
        </zg-data>
      </zing-grid>
    
    </body>
    
    </html>
    html,
    body {
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
    
    zg-caption h1 {
      font-size: 2rem;
    }
    
    zg-caption p {
      font-size: 1rem;
    }
    
    zg-head {
      font-size: 1.3rem;
    }
    function createFilterURL(oFilter) {
      // Keys should use values from `[filter-key]` instead of `[index]`
      console.log(oFilter);
      return `?filter=${encodeURIComponent(JSON.stringify(oFilter))}`;
    };