Advertisement
sandhysanjaya

coba.js

Jan 25th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import axios from 'axios';
  3. const $ = require('jquery');
  4. $.Datatable = require('datatables.net');
  5.  
  6. export default class Coba extends Component {
  7.     constructor(props) {
  8.         super(props);
  9.     }
  10.     componentDidMount(){
  11.         var kolom = this.props.kolom;
  12.         var data = this.props.data;
  13.         console.log(kolom)
  14.         console.log(data)
  15.         // axios.get('https://next.json-generator.com/api/json/get/NkmVhBGB4', {
  16.         //     mode: 'no-cors',
  17.         //     headers: {
  18.                
  19.         //     },
  20.         // }).then(function(result) {    
  21.             $('#example').DataTable( {
  22.                 data: data,
  23.                 columns: kolom
  24.             });
  25.         // })  
  26.        
  27.     }
  28.  
  29.     componentWillMount(){
  30.  
  31.     }
  32.  
  33.     render(){
  34.         return (
  35.             <div className="wrapper wrapper-content animated fadeInRight">
  36.                 <div className="row">
  37.                     <div className="col-lg-12">
  38.                         <div className="ibox float-e-margins">
  39.                             <div className="ibox-title">
  40.                                 <h5>Basic Data Tables example with responsive plugin</h5>
  41.                                 {/* <div className="ibox-tools">
  42.                                     <a className="collapse-link">
  43.                                         <i className="fa fa-chevron-up"></i>
  44.                                     </a>
  45.                                     <a className="dropdown-toggle" data-toggle="dropdown" href="#">
  46.                                         <i className="fa fa-wrench"></i>
  47.                                     </a>
  48.                                     <ul className="dropdown-menu dropdown-user">
  49.                                         <li><a href="#">Config option 1</a>
  50.                                         </li>
  51.                                         <li><a href="#">Config option 2</a>
  52.                                         </li>
  53.                                     </ul>
  54.                                     <a className="close-link">
  55.                                         <i className="fa fa-times"></i>
  56.                                     </a>
  57.                                 </div> */}
  58.                             </div>
  59.                             <div className="ibox-content">
  60.                             <table id="example" className="table table-striped table-bordered table-hover dataTables-example" width="100%"></table>
  61.                             </div>
  62.                         </div>
  63.                     </div>
  64.                 </div>
  65.             </div>
  66.         )
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement