• 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. zg-caption h1 {
    18. font-size: 2rem;
    19. }
    20.  
    21. zg-caption p {
    22. font-size: 1rem;
    23. }
    24.  
    25. zg-head {
    26. font-size: 1.3rem;
    27. }
    28.  
    29. zing-grid {
    30. margin-top: 1rem;
    31. }
    32.  
    33. zing-grid[loading] {
    34. height: 701px;
    35. }
    36. </style>
    37. </head>
    38.  
    39. <body>
    40. <h3>`[filter-menu-areas]` sets the areas to display in the filter menu.</h3>
    41. <select>
    42. <option value="both" selected>both</option>
    43. <option value="conditions">conditions</option>
    44. <option value="selectbox">selectbox</option>
    45. </select>
    46. <zing-grid caption="Store Items (HTML example w/ one unfilter column)" filter="both" filter-menu-areas="both">
    47. <zg-colgroup>
    48. <zg-column index="item" header="Item"></zg-column>
    49. <zg-column index="color" header="Color"></zg-column>
    50. <zg-column index="size" header="Size"></zg-column>
    51. <zg-column index="price" header="Price" filter="disabled" type="currency" type-currency="USD"></zg-column>
    52. </zg-colgroup>
    53. <zg-data data='[{
    54. "item": "shirt",
    55. "color": "red",
    56. "size": "medium",
    57. "price": "5"
    58. }, {
    59. "item": "hat",
    60. "color": "brown",
    61. "size": "na",
    62. "price": "10"
    63. }, {
    64. "item": "shirt",
    65. "color": "blue",
    66. "size": "small",
    67. "price": "5"
    68. }, {
    69. "item": "jeans",
    70. "color": "blue",
    71. "size": "large",
    72. "price": "25"
    73. }, {
    74. "item": "scarf",
    75. "color": "purple",
    76. "size": "na",
    77. "price": "12"
    78. }, {
    79. "item": "shirt",
    80. "color": "pink",
    81. "size": "medium",
    82. "price": "14"
    83. }, {
    84. "item": "jeans",
    85. "color": "black",
    86. "size": "large",
    87. "price": "40"
    88. }, {
    89. "item": "jacket",
    90. "color": "black",
    91. "size": "medium",
    92. "price": "100"
    93. }, {
    94. "item": "jeans",
    95. "color": "red",
    96. "size": "small",
    97. "price": "35"
    98. }, {
    99. "item": "shirt",
    100. "color": "yellow",
    101. "size": "medium",
    102. "price": "16"
    103. }, {
    104. "item": "jacket",
    105. "color": "red",
    106. "size": "large",
    107. "price": "30"
    108. }]'></zg-data>
    109. </zing-grid>
    110. <script>
    111. ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']); // window:load event for Javascript to run after HTML
    112. // because this Javascript is injected into the document head
    113. window.addEventListener('load', () => {
    114. // Javascript code to execute after DOM content
    115. const selectRef = document.querySelector('select');
    116. const zgRef = document.querySelector('zing-grid');
    117. selectRef.addEventListener('change', e => {
    118. zgRef.setAttribute('filter-menu-areas', e.target.value);
    119. });
    120. });
    121. </script>
    122. </body>
    123.  
    124. </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. <h3>`[filter-menu-areas]` sets the areas to display in the filter menu.</h3>
    12. <select>
    13. <option value="both" selected>both</option>
    14. <option value="conditions">conditions</option>
    15. <option value="selectbox">selectbox</option>
    16. </select>
    17. <zing-grid caption="Store Items (HTML example w/ one unfilter column)" filter="both" filter-menu-areas="both">
    18. <zg-colgroup>
    19. <zg-column index="item" header="Item"></zg-column>
    20. <zg-column index="color" header="Color"></zg-column>
    21. <zg-column index="size" header="Size"></zg-column>
    22. <zg-column index="price" header="Price" filter="disabled" type="currency" type-currency="USD"></zg-column>
    23. </zg-colgroup>
    24. <zg-data data='[{
    25. "item": "shirt",
    26. "color": "red",
    27. "size": "medium",
    28. "price": "5"
    29. }, {
    30. "item": "hat",
    31. "color": "brown",
    32. "size": "na",
    33. "price": "10"
    34. }, {
    35. "item": "shirt",
    36. "color": "blue",
    37. "size": "small",
    38. "price": "5"
    39. }, {
    40. "item": "jeans",
    41. "color": "blue",
    42. "size": "large",
    43. "price": "25"
    44. }, {
    45. "item": "scarf",
    46. "color": "purple",
    47. "size": "na",
    48. "price": "12"
    49. }, {
    50. "item": "shirt",
    51. "color": "pink",
    52. "size": "medium",
    53. "price": "14"
    54. }, {
    55. "item": "jeans",
    56. "color": "black",
    57. "size": "large",
    58. "price": "40"
    59. }, {
    60. "item": "jacket",
    61. "color": "black",
    62. "size": "medium",
    63. "price": "100"
    64. }, {
    65. "item": "jeans",
    66. "color": "red",
    67. "size": "small",
    68. "price": "35"
    69. }, {
    70. "item": "shirt",
    71. "color": "yellow",
    72. "size": "medium",
    73. "price": "16"
    74. }, {
    75. "item": "jacket",
    76. "color": "red",
    77. "size": "large",
    78. "price": "30"
    79. }]'></zg-data>
    80. </zing-grid>
    81. </body>
    82.  
    83. </html>
    1. html,
    2. body {
    3. height: 100%;
    4. width: 100%;
    5. margin: 0;
    6. padding: 0;
    7. }
    8.  
    9. zg-caption h1 {
    10. font-size: 2rem;
    11. }
    12.  
    13. zg-caption p {
    14. font-size: 1rem;
    15. }
    16.  
    17. zg-head {
    18. font-size: 1.3rem;
    19. }
    20.  
    21. zing-grid {
    22. margin-top: 1rem;
    23. }
    1. // window:load event for Javascript to run after HTML
    2. // because this Javascript is injected into the document head
    3. window.addEventListener('load', () => {
    4. // Javascript code to execute after DOM content
    5. const selectRef = document.querySelector('select');
    6. const zgRef = document.querySelector('zing-grid');
    7. selectRef.addEventListener('change', e => {
    8. zgRef.setAttribute('filter-menu-areas', e.target.value);
    9. });
    10. });