• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid Demo</title>
      <script src="https://cdn.zinggrid.com/zinggrid.min.js" defer></script>
      <style>
        body {
          background: #e6e6e6;
        }
    
        zing-grid {
          overflow: hidden;
        }
    
        zing-grid[loading] {
          height: 373px;
        }
      </style>
    </head>
    
    <body>
      <zing-grid caption="Class Schedules" sort viewport-stop data='[
            {
              "class": "Biology 101",
              "days": "M/W",
              "time": "7:00am - 8:30am",
              "instructor": "Foster"
            }, {
              "class": "C++ Programming 101",
              "days" : "-- TBD --",
              "time": "-- TBD --",
              "instructor": "Smith"
            }, {
              "class": "Biology 101",
              "days" : "T/TH",
              "time": "2:30pm - 4:00pm",
              "instructor": "Doe"
            }, {
              "class": "Biology 101",
              "days" : "-- TBD --",
              "time": "-- TBD --",
              "instructor": "-- TBD --"
            }, {
              "class": "C++ Programming 101",
              "days" : "M",
              "time": "10:00pm - 12:30pm",
              "instructor": "-- TBD --"
            }
          ]'>
        <zg-colgroup>
          <zg-column index="class"></zg-column>
          <zg-column index="days" sorter="deprioritizeTBD" sort-asc></zg-column>
          <zg-column index="time"></zg-column>
          <zg-column index="instructor"></zg-column>
        </zg-colgroup>
      </zing-grid>
      <script>
        function deprioritizeTBD(a, b) {
          if (a.days == '-- TBD --') return 1;
          if (b.days == '-- TBD --') return -1;
          return a.days > b.days ? 1 : -1;
        }
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid Demo</title>
      <script src="https://cdn.zinggrid.com/zinggrid.min.js" defer></script>
    </head>
    
    <body>
      <zing-grid caption="Class Schedules" sort viewport-stop data='[
            {
              "class": "Biology 101",
              "days": "M/W",
              "time": "7:00am - 8:30am",
              "instructor": "Foster"
            }, {
              "class": "C++ Programming 101",
              "days" : "-- TBD --",
              "time": "-- TBD --",
              "instructor": "Smith"
            }, {
              "class": "Biology 101",
              "days" : "T/TH",
              "time": "2:30pm - 4:00pm",
              "instructor": "Doe"
            }, {
              "class": "Biology 101",
              "days" : "-- TBD --",
              "time": "-- TBD --",
              "instructor": "-- TBD --"
            }, {
              "class": "C++ Programming 101",
              "days" : "M",
              "time": "10:00pm - 12:30pm",
              "instructor": "-- TBD --"
            }
          ]'>
        <zg-colgroup>
          <zg-column index="class"></zg-column>
          <zg-column index="days" sorter="deprioritizeTBD" sort-asc></zg-column>
          <zg-column index="time"></zg-column>
          <zg-column index="instructor"></zg-column>
        </zg-colgroup>
      </zing-grid>
    </body>
    
    </html>
    body {
      background: #e6e6e6;
    }
    
    zing-grid {
      overflow: hidden;
    }
    function deprioritizeTBD(a, b) {
      if (a.days == '-- TBD --') return 1;
      if (b.days == '-- TBD --') return -1;
      return a.days > b.days ? 1 : -1;
    }