CakePHP
GridJS Table
GridJS Table

There are few options on how to include/import Grid.js into your project.

Install from NPM

Install the Grid.js Js library using command prompt from the root directory of the project:

npm install gridjs --save

Link the Grid.js package.

<!-- CSS File -->
<link rel="stylesheet" href="./assets/libs/gridjs/theme/mermaid.min.css">
                    
<!-- JavaScript File -->
<script src="assets/libs/gridjs/gridjs.umd.js"></script>

Check the below example how to use and make it working Grid.js on any page.

HTML

<div id="basicTable"></div>

JavaScript

//basic Table
new gridjs.Grid({
    className: {
        table: 'text-nowrap',
    },
    columns: ["Name", "Email", "Phone Number"],
    data: [
        ["John", "john@example.com", "(353) 01 222 3333"],
        ["Mark", "mark@gmail.com", "(01) 22 888 4444"],
        ["Eoin", "eoin@gmail.com", "0097 22 654 00033"],
        ["Sarah", "sarahcdd@gmail.com", "+322 876 1233"],
        ["Afshin", "afshin@mail.com", "(353) 22 87 8356"]
    ]
}).render(document.getElementById("basicTable"));