• 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. body {
    10. background: #e6e6e6;
    11. }
    12.  
    13. zing-grid[loading] {
    14. height: 450px;
    15. }
    16. </style>
    17. </head>
    18.  
    19. <body>
    20. <zing-grid caption="Movies" preserve-state-id="featuresGridState4" columns-control column-drag filter="both" layout-controls pager page-size="4" page-size-options="2,4,10,20" search sort src="https://zinggrid-examples.firebaseio.com/movies/">
    21. </zing-grid>
    22. <script>
    23. ZingGrid.setLicense(['26ccbfec16b8be9ee98c7d57bee6e498']);
    24. window.addEventListener('load', () => {
    25. let sortState = {
    26. "sort": {
    27. "index": "director",
    28. "order": 1
    29. }
    30. };
    31. let zgRef = document.querySelector('zing-grid');
    32. zgRef.executeOnLoad(() => {
    33. zgRef.setState(sortState);
    34. // alternatively
    35. // zgRef.setStateField('sort', sortState.sort);
    36. });
    37. });
    38. </script>
    39. </body>
    40.  
    41. </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 caption="Movies" preserve-state-id="featuresGridState4" columns-control column-drag filter="both" layout-controls pager page-size="4" page-size-options="2,4,10,20" search sort src="https://zinggrid-examples.firebaseio.com/movies/">
    12. </zing-grid>
    13. </body>
    14.  
    15. </html>
    1. body {
    2. background: #e6e6e6;
    3. }
    1. window.addEventListener('load', () => {
    2. let sortState = {
    3. "sort": {
    4. "index": "director",
    5. "order": 1
    6. }
    7. };
    8. let zgRef = document.querySelector('zing-grid');
    9. zgRef.executeOnLoad(() => {
    10. zgRef.setState(sortState);
    11. // alternatively
    12. // zgRef.setStateField('sort', sortState.sort);
    13. });
    14. });