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