Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card.

Overview

ModernTable GitHub version License: MIT

Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card.

Notes:

  • Only targets modern browsers.
  • To help Microsoft phase out IE11 and in anticipation of Bootstrap 5 dropping IE support, IE is not supported.
  • Compatible with Bootstrap 4.4.1 and higher.
  • Specifically tested with Bootstrap 4.4.1 and 4.5.3.
  • Theoretically, this should work with other CSS frameworks. However, this has NOT been tested with other CSS frameworks, so your mileage may vary.
  • If number or date formatting are specified in the configuration, but the proper library does not load, this gracefully fails to no formatting.
  • Strongly recommended to use ISO 8601 date formats in your source data and configuration. Then use the UI for localization.

Live Demo

https://simplenotsimpler.github.io/modern-table-example/

Getting Started

Documentation

https://simplenotsimpler.github.io/modern-table/

Requires:

Recommended:

CDN:

  • CSS:

  • JS:

Example

HTML:

">
<div class="card card-body rounded shadow-lg">
    <div id="table-container" class="table-responsive table-height">div>
div>

JS:

const localJSON = 'data/sample-sales-data.json';

const sampleTable = new ModernTable(
  'table-container', // tableContainerID
  'sample-table', // tableID
  localJSON, // dataURL
  {
    tableClasses: 'table table-bordered table-striped table-hover table-sticky table-sm',
    tableCaption: 'Sample Sales Data',  
    searchClasses: 'form-control mb-2 w-25 float-right',
    colConfig: {
      'rpt_date': {
        'format': 'date-us',
        'dateFrom': 'YYYY-MM-DD',
        'dateTo': 'MM/DD/YY',
        'columnTitle': 'report date'
      },
      'new_customers': {
        'format': 'number-grouped',
        'alignment': 'right'
      },
      'revenue': {
        'format': 'currency-us',
        'alignment': 'right'
      },
      'cogs': {
        'format': 'currency-us',
        'alignment': 'right'
      },
      'profit': {
        'format': 'currency-us',
        'alignment': 'right'
      },
      'profit_margin': {
        'format': 'percent',
        'numDecimals': 1,
        'alignment': 'right'
      }
    }
  });

Styling

For the most part, the table is stylistically agnostic with a few exceptions which allow for a simple table scroll:

  • Container for the table has explicit height and overflow. These can be overriden.
  • Table header is sticky.
  • Sticky table header makes the header row background transparent, so this was explicitly set. This can be overridden.

For details on specific classes see modern-table.css.

License

This project is MIT licensed.

You might also like...

Convert table to card when on phone

Convert table to card when on phone

Convert table to card see index.html for example converts table to card when viewport is = 425px HTML Syntax table !-- table headings -- th

May 3, 2022

A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YAML support designed to be easy to set up and use

A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YAML support designed to be easy to set up and use

About A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YML

Dec 28, 2022

Awesome book with ES6, this project is build using HTML,CSS, JavaScript ES6 the project allows you to add books and save them with the author , for another time checks

Project Name Awsome books Description the project. adding books daynamiclly Built With Major languages Frameworks Technologies used Live Demo (if avai

Jul 25, 2022

Simple Library implemented using HTML, CSS and JavaScript. This is a simple implementation of JavaScript Modules of ES6.

Awesome-books A single page project with the porpuse of storing books' titles and authors. Built With CSS, HTML & Javascript. How to run in your local

Feb 21, 2022

Simply Netflix clone using ReactJS. It fetches the data from TMDB API

Simply Netflix clone using ReactJS. It fetches the data from TMDB API

NETFLIX CLONE This project is a simply front end clone of Netflix. It was created with React. It uses The MovieDB Api to search for movies and display

Dec 9, 2022

a web crawler that crawls website links & fetches SEO Data

Overview 📝 It is a module that crawls sites and extracts basic information on any web page of interest to site owners in general, and SEO specialists

Dec 15, 2022

a lightweight, dependency-free JavaScript plugin which makes a HTML table interactive

JSTable The JSTable is a lightweight, dependency-free JavaScript plugin which makes a HTML table interactive. The plugin is similar to the jQuery data

Oct 20, 2022
Comments
  • Test Pull Request

    Test Pull Request

    This is a pull request from an attempt to use release branch workflow per the GitHub Learning course: Create a release based workflow. Decided that for the time being will stick to simple GitHub Flow and work on feature branches locally.

    opened by simplenotsimpler 1
Owner
SimpleNotSimpler
Pragmatic web developer with a “simple but not simpler” approach to creating user-friendly, accessible applications...let's connect!
SimpleNotSimpler
JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

Aykut Saraç 20.6k Jan 4, 2023
A Cloudflare Workers service that fetches and renders Notion pages as HTML, Markdown, or JSON.

notion-fetch A Cloudflare Workers service that fetches and renders Notion pages as HTML, Markdown, or JSON. Powered by Durable Objects and R2. Usage P

Heyang Zhou 7 Jan 6, 2023
Pretty-print-json - 🦋 Pretty-print JSON data into HTML to indent and colorize (written in TypeScript)

pretty-print-json Pretty-print JSON data into HTML to indent and colorize (written in TypeScript) 1) Try It Out Interactive online tool to format JSON

Center Key 87 Dec 30, 2022
A Hulu Clone which created with NextJS. It fetches the data from TMDB (The Movie Database) API.

A Hulu Clone which created with NextJS. It fetches the data from TMDB (The Movie Database) API. Click demo to try it by yourself! Hulu Clone Demo Link

Özge Coşkun Gürsucu 10 Aug 17, 2022
A simple Form Validation Utility for Bootstrap 3, Bootstrap 4, and Bootstrap 5 for Humans.

bootstrap-validate A simple Form Validation Utility for Bootstrap 3, Bootstrap 4, and Bootstrap 5 for Humans. ?? Support us with Developer Merchandise

null 138 Jan 2, 2023
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
🤖 An action that fetches the list of malicious domains on Discord in different providers and creates/updates a JSON file with them from time to time.

Discord Guardian Action ??  This action fetches the list of malicious domains on Discord in different providers and creates/updates a JSON file with t

Dalton Menezes 7 Nov 30, 2022
Extends Bootstrap Tooltips and Popovers by adding custom classes. Available for Bootstrap 3 and Bootstrap 4.

Bootstrap Tooltip Custom Class Extends Bootstrap Tooltips and Popovers by adding custom classes. Available for Bootstrap 3 and Bootstrap 4. Define you

Andrei Victor Bulearca 14 Feb 10, 2022
Create a HTML table from JSON that can be sorted, selected, and post-processed using a simple callback.

Tidy Table Create a HTML table from JSON that can be sorted, selected, and post-processed using a simple callback. Features Extensible HTML/CSS interf

Marc S. Brooks 50 Aug 16, 2022