Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react table with styles

// Styles should be in index.js
import '@fortawesome/fontawesome-free/css/all.min.css'; 
import 'bootstrap-css-only/css/bootstrap.min.css';
import 'mdbreact/dist/css/mdb.css';

// Components
import React from 'react';
import { MDBDataTableV5 } from 'mdbreact';

export default function Basic() {
  const [datatable, setDatatable] = React.useState({
    columns: [
      {
        label: 'Name',
        field: 'name',
        width: 150,
        attributes: {
          'aria-controls': 'DataTable',
          'aria-label': 'Name',
        },
      },
      {
        label: 'Position',
        field: 'position',
        width: 270,
      },
      {
        label: 'Office',
        field: 'office',
        width: 200,
      },
      {
        label: 'Age',
        field: 'age',
        sort: 'asc',
        width: 100,
      },
      {
        label: 'Start date',
        field: 'date',
        sort: 'disabled',
        width: 150,
      },
      {
        label: 'Salary',
        field: 'salary',
        sort: 'disabled',
        width: 100,
      },
    ],
    rows: [
      {
        name: 'Tiger Nixon',
        position: 'System Architect',
        office: 'Edinburgh',
        age: '61',
        date: '2011/04/25',
        salary: '$320',
      },
      {
        name: 'Garrett Winters',
        position: 'Accountant',
        office: 'Tokyo',
        age: '63',
        date: '2011/07/25',
        salary: '$170',
      },
      {
        name: 'Ashton Cox',
        position: 'Junior Technical Author',
        office: 'San Francisco',
        age: '66',
        date: '2009/01/12',
        salary: '$86',
      },
      {
        name: 'Cedric Kelly',
        position: 'Senior Javascript Developer',
        office: 'Edinburgh',
        age: '22',
        date: '2012/03/29',
        salary: '$433',
      },
      {
        name: 'Airi Satou',
        position: 'Accountant',
        office: 'Tokyo',
        age: '33',
        date: '2008/11/28',
        salary: '$162',
      },
      {
        name: 'Brielle Williamson',
        position: 'Integration Specialist',
        office: 'New York',
        age: '61',
        date: '2012/12/02',
        salary: '$372',
      },
      {
        name: 'Herrod Chandler',
        position: 'Sales Assistant',
        office: 'San Francisco',
        age: '59',
        date: '2012/08/06',
        salary: '$137',
      },
      {
        name: 'Rhona Davidson',
        position: 'Integration Specialist',
        office: 'Tokyo',
        age: '55',
        date: '2010/10/14',
        salary: '$327',
      },
  
    ],
  });

  return <MDBDataTableV5 hover entriesOptions={[5, 20, 25]} entries={5} pagesAmount={4} data={datatable} />;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js-cookie 
Javascript :: jquery get return jquery object 
Javascript :: v-show example in vue js 
Javascript :: mongoose node js 
Javascript :: why is this undefined in react 
Javascript :: wild card select jquery 
Javascript :: get element attribute jquery 
Javascript :: gps nodejs 
Javascript :: what are escape characters in javascript 
Javascript :: json web token flask 
Javascript :: nested for loop in angular 
Javascript :: limit number in javascript 
Javascript :: Finding Value of Promise With Then Syntax 
Javascript :: react navigation params 
Javascript :: react native flatlist flex direction 
Javascript :: $(...).DataTable is not a function 
Javascript :: nested arrays reactjs tables 
Javascript :: write !important in react 
Javascript :: escape character javascript 
Javascript :: nodejs redis 
Javascript :: vue js override component css 
Javascript :: Check Object Is Instance Of Class 
Javascript :: how to compile javascript 
Javascript :: how to open cypress 
Javascript :: object to string js 
Javascript :: react createelement 
Javascript :: how to display json data in html 
Javascript :: error: Error: Unable to resolve module `crypto` from `node_modulescrypto-jscore.js`: crypto could not be found within the project. 
Javascript :: longest word in a string 
Javascript :: deploy react and express to heroku 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =