123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta name="description" content="Webpage description goes here" />
- <meta charset="utf-8">
- <title>Change_me</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="author" content="">
- <link rel="stylesheet" href="css/style.css">
- <script src="http://code.jquery.com/jquery-latest.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
- <!-- <script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
- <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script> -->
- <script src="https://unpkg.com/ag-grid-community/dist/ag-grid-community.min.js"></script>
- </head>
- <body>
- <div class="container">
- </div>
- <div id="like_button_container"></div>
- <button onclick="exportcsv();">123</button>
- <div id="myGrid" style="height: 600px;width:800px;" class="ag-theme-alpine"></div>
- <script>
- const columnDefs = [
- { field: "name" },
- { field: "email" },
- { field: "phone" }
- ];
- // let the grid know which columns to use
- const gridOptions = {
- columnDefs: columnDefs
- };
- // lookup the container we want the Grid to use
- const eGridDiv = document.querySelector('#myGrid');
- // create the grid passing in the div to use together with the columns & data we want to use
- new agGrid.Grid(eGridDiv, gridOptions);
- // fetch the row data to use and one ready provide it to the Grid via the Grid API
- /* agGrid.simpleHttpRequest({ url: 'https://go.hhh.com.tw:8002/deco_request' })
- .then(data => {
- console.log(data);
- gridOptions.api.setRowData(data);
- }); */
- axios.get("https://go.hhh.com.tw:8002/deco_request").then((data1) => {
- console.log(data1.data);
- gridOptions.api.setRowData(data1.data);
- });
- function exportcsv() {
- gridOptions.api.exportDataAsCsv();
- //gridOptions.api.exportDataAsExcel();
- }
- /* 'use strict';
- const e = React.createElement;
- class LikeButton extends React.Component {
- constructor(props) {
- super(props);
- this.state = { liked: false };
- }
- render() {
- if (this.state.liked) {
- return 'You liked this.';
- }
- return e(
- 'button',
- { onClick: () => this.setState({ liked: true }) },
- 'Like'
- );
- }
- }
- const domContainer = document.querySelector('#like_button_container');
- ReactDOM.render(e(LikeButton), domContainer); */
- </script>
- </body>
- </html>
|