blank.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta name="description" content="Webpage description goes here" />
  5. <meta charset="utf-8">
  6. <title>Change_me</title>
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8. <meta name="author" content="">
  9. <link rel="stylesheet" href="css/style.css">
  10. <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  11. <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  12. <!-- <script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
  13. <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script> -->
  14. <script src="https://unpkg.com/ag-grid-community/dist/ag-grid-community.min.js"></script>
  15. </head>
  16. <body>
  17. <div class="container">
  18. </div>
  19. <div id="like_button_container"></div>
  20. <button onclick="exportcsv();">123</button>
  21. <div id="myGrid" style="height: 600px;width:800px;" class="ag-theme-alpine"></div>
  22. <script>
  23. const columnDefs = [
  24. { field: "name" },
  25. { field: "email" },
  26. { field: "phone" }
  27. ];
  28. // let the grid know which columns to use
  29. const gridOptions = {
  30. columnDefs: columnDefs
  31. };
  32. // lookup the container we want the Grid to use
  33. const eGridDiv = document.querySelector('#myGrid');
  34. // create the grid passing in the div to use together with the columns & data we want to use
  35. new agGrid.Grid(eGridDiv, gridOptions);
  36. // fetch the row data to use and one ready provide it to the Grid via the Grid API
  37. /* agGrid.simpleHttpRequest({ url: 'https://go.hhh.com.tw:8002/deco_request' })
  38. .then(data => {
  39. console.log(data);
  40. gridOptions.api.setRowData(data);
  41. }); */
  42. axios.get("https://go.hhh.com.tw:8002/deco_request").then((data1) => {
  43. console.log(data1.data);
  44. gridOptions.api.setRowData(data1.data);
  45. });
  46. function exportcsv() {
  47. gridOptions.api.exportDataAsCsv();
  48. //gridOptions.api.exportDataAsExcel();
  49. }
  50. /* 'use strict';
  51. const e = React.createElement;
  52. class LikeButton extends React.Component {
  53. constructor(props) {
  54. super(props);
  55. this.state = { liked: false };
  56. }
  57. render() {
  58. if (this.state.liked) {
  59. return 'You liked this.';
  60. }
  61. return e(
  62. 'button',
  63. { onClick: () => this.setState({ liked: true }) },
  64. 'Like'
  65. );
  66. }
  67. }
  68. const domContainer = document.querySelector('#like_button_container');
  69. ReactDOM.render(e(LikeButton), domContainer); */
  70. </script>
  71. </body>
  72. </html>