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