<!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 { --zg-head-cell-color_sorted: #fff; --zg-head-cell-background_sorted: #466D79; --zg-cell-background_sorted: #bed6dd; } 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-desc></zg-column> <zg-column index="time"></zg-column> <zg-column index="instructor"></zg-column> </zg-colgroup> </zing-grid> <script> ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']); 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"></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-desc></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 { --zg-head-cell-color_sorted: #fff; --zg-head-cell-background_sorted: #466D79; --zg-cell-background_sorted: #bed6dd; }
function deprioritizeTBD(a, b) { if (a.days == '-- TBD --') return 1; if (b.days == '-- TBD --') return -1; return a.days > b.days ? 1 : -1; }