• Edit
  • Download
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingGrid Demo</title>
    7. <script nonce="undefined" src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
    8. <style>
    9. html,
    10. body {
    11. height: 100%;
    12. width: 100%;
    13. margin: 0;
    14. padding: 0;
    15. }
    16.  
    17. zing-grid[loading] {
    18. height: 165px;
    19. }
    20. </style>
    21. </head>
    22.  
    23. <body>
    24. <zing-grid>
    25. <zg-colgroup>
    26. <!-- Toggles through two values -->
    27. <zg-column index="boolean" type="toggle" type-toggle-options='["true","false"]'></zg-column>
    28.  
    29. <!-- Toggles with two+ values requires renderer -->
    30. <zg-column index="suite" type="toggle" renderer="render_suite" type-toggle-options='["♣","♦","♥","♠"]'></zg-column>
    31.  
    32. <!-- Uses the render_color method to display the proper item with many toggle options -->
    33. <zg-column index="color" type="toggle" renderer="render_color" type-toggle-options='["red", "orange", "yellow", "green", "blue"]'></zg-column>
    34. </zg-colgroup>
    35. <zg-data data='[
    36. {
    37. "boolean": true,
    38. "suite": "♣",
    39. "color": "red"
    40. }, {
    41. "boolean": false,
    42. "suite": "♥",
    43. "color": "blue"
    44. }
    45. ]'></zg-data>
    46. </zing-grid>
    47. <script>
    48. ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']);
    49. window.render_suite = (curVal, $cell) => {
    50. return curVal;
    51. };
    52.  
    53. window.render_color = (curVal, $cell) => {
    54. return `<img src="https://storage.googleapis.com/zg-demos.appspot.com/toggle_column/${curVal}.png" width="25px" height="25px">`;
    55. };
    56. </script>
    57. </body>
    58.  
    59. </html>
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingGrid Demo</title>
    7. <script src="https://cdn.zinggrid.com/zinggrid.min.js"></script>
    8. </head>
    9.  
    10. <body>
    11. <zing-grid>
    12. <zg-colgroup>
    13. <!-- Toggles through two values -->
    14. <zg-column index="boolean" type="toggle" type-toggle-options='["true","false"]'></zg-column>
    15.  
    16. <!-- Toggles with two+ values requires renderer -->
    17. <zg-column index="suite" type="toggle" renderer="render_suite" type-toggle-options='["♣","♦","♥","♠"]'></zg-column>
    18.  
    19. <!-- Uses the render_color method to display the proper item with many toggle options -->
    20. <zg-column index="color" type="toggle" renderer="render_color" type-toggle-options='["red", "orange", "yellow", "green", "blue"]'></zg-column>
    21. </zg-colgroup>
    22. <zg-data data='[
    23. {
    24. "boolean": true,
    25. "suite": "♣",
    26. "color": "red"
    27. }, {
    28. "boolean": false,
    29. "suite": "♥",
    30. "color": "blue"
    31. }
    32. ]'></zg-data>
    33. </zing-grid>
    34. </body>
    35.  
    36. </html>
    1. html,
    2. body {
    3. height: 100%;
    4. width: 100%;
    5. margin: 0;
    6. padding: 0;
    7. }
    1. window.render_suite = (curVal, $cell) => {
    2. return curVal;
    3. };
    4.  
    5. window.render_color = (curVal, $cell) => {
    6. return `<img src="https://storage.googleapis.com/zg-demos.appspot.com/toggle_column/${curVal}.png" width="25px" height="25px">`;
    7. };