Documentation v8.0.9

Add Rows

New rows can be added to a DataTable using the row.add()API method. Simply call the API function with the data for the new row (be it an array or object).
Column 1 Column 2 Column 3 Column 4 Column 5
Column 1 Column 2 Column 3 Column 4 Column 5
<div class="pb-10">
    <button class="btn btn-primary" id="kt_datatable_example_1_addrow">Add New Row</button>
</div>
<table id="kt_datatable_example_1" class="table table-striped table-row-bordered gy-5 gs-7">
    <thead>
        <tr class="fw-bold fs-6 text-gray-800">
            <th>Column 1</th>
            <th>Column 2</th>
            <th>Column 3</th>
            <th>Column 4</th>
            <th>Column 5</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th>Column 1</th>
            <th>Column 2</th>
            <th>Column 3</th>
            <th>Column 4</th>
            <th>Column 5</th>
        </tr>
    </tfoot>
</table>
var t = $("#kt_datatable_example_1").DataTable();
var counter = 1;

$("#kt_datatable_example_1_addrow").on("click", function() {
    t.row.add([
        counter + ".1",
        counter + ".2",
        counter + ".3",
        counter + ".4",
        counter + ".5",
    ]).draw(false);

    counter++;
});

// Automatically add a first row of data
$("#kt_datatable_example_1_addrow").click();

Form Inputs

In order to perform paging, ordering, searching etc, DataTables can remove rows and cells from the document (i.e. those rows / cells which are not needed are not inserted into the document).
Name Age Position Office
Tiger Nixon
Garrett Winters
Ashton Cox
Cedric Kelly
Airi Satou
Brielle Williamson
Herrod Chandler
Rhona Davidson
Colleen Hurst
Sonya Frost
Jena Gaines
Quinn Flynn
Charde Marshall
Haley Kennedy
Tatyana Fitzpatrick
Michael Silva
Paul Byrd
Gloria Little
Bradley Greer
<div class="pb-10">
    <button class="btn btn-primary" id="kt_datatable_example_2_submit">Submit Form</button>
</div>
<table id="kt_datatable_example_2" class="table table-row-bordered table-row-dashed gy-5">
    <thead>
        <tr class="fw-bold fs-6 text-gray-800">
            <th>Name</th>
            <th>Age</th>
            <th>Position</th>
            <th>Office</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Tiger Nixon</td>
            <td><input type="text" class="form-control  form-control-solid" id="row-1-age" name="row-1-age" value="61"/></td>
            <td><input type="text" class="form-control  form-control-solid" id="row-1-position" name="row-1-position" value="System Architect"/></td>
            <td>
                <select  class="form-select  form-select-solid" size="1" id="row-1-office" name="row-1-office">
                    <option value="Edinburgh" selected="selected">
                        Edinburgh
                    </option>
                    <option value="London">
                        London
                    </option>
                    <option value="New York">
                        New York
                    </option>
                    <option value="San Francisco">
                        San Francisco
                    </option>
                    <option value="Tokyo">
                        Tokyo
                    </option>
                </select>
            </td>
        </tr>
        <tr>
            <td>Garrett Winters</td>
            <td><input type="text" class="form-control  form-control-solid" id="row-2-age" name="row-2-age" value="63"/></td>
            <td><input type="text" class="form-control  form-control-solid" id="row-2-position" name="row-2-position" value="Accountant"/></td>
            <td>
                <select  class="form-select  form-select-solid" size="1" id="row-2-office" name="row-2-office">
                    <option value="Edinburgh">
                        Edinburgh
                    </option>
                    <option value="London">
                        London
                    </option>
                    <option value="New York">
                        New York
                    </option>
                    <option value="San Francisco">
                        San Francisco
                    </option>
                    <option value="Tokyo" selected="selected">
                        Tokyo
                    </option>
                </select>
            </td>
        </tr>
    </tbody>
</table>
var table = $("#kt_datatable_example_2").DataTable({
    columnDefs: [{
        orderable: false,
        targets: [1, 2, 3]
    }]
});

$("#kt_datatable_example_2_submit").click(function() {
    var data = table.$("input, select").serialize();
    alert(
        "The following data would have been submitted to the server: \n\n" +
        data.substr(0, 120) + "..."
    );
    return false;
});

Activity Logs

There are 2 new tasks for you in “AirPlus Mobile APp” project:
Added at 4:23 PM by
img
Meeting with customer
Application Design
img
img
A
In Progress
View
Project Delivery Preparation
CRM System Development
img
B
Completed
View
Invitation for crafting engaging designs that speak human workshop
Sent at 4:23 PM by
img
Task #45890merged with #45890in “Ads Pro Admin Dashboard project:
Initiated at 4:23 PM by
img
3 new application design concepts added:
Created at 4:23 PM by
img
New case #67890is assigned to you in Multi-platform Database Design project
Added at 4:23 PM by
Alice Tan
You have received a new order:
Placed at 5:05 AM by
img

Database Backup Process Completed!

Login into Metronic Admin Dashboard to make sure the data integrity is OK
Proceed
New order #67890is placed for Workshow Planning & Budget Estimation
Placed at 4:23 PM by
Jimmy Bold
Pic
Brian Cox 2 mins
How likely are you to recommend our company to your friends and family ?
5 mins You
Pic
Hey there, we’re just writing to let you know that you’ve been subscribed to a repository on GitHub.
Pic
Brian Cox 1 Hour
Ok, Understood!
2 Hours You
Pic
You’ll receive notifications for all issues, pull requests!
Pic
Brian Cox 3 Hours
You can unwatch this repository immediately by clicking here: Keenthemes.com
4 Hours You
Pic
Most purchased Business courses during this sale!
Pic
Brian Cox 5 Hours
Company BBQ to celebrate the last quater achievements and goals. Food and drinks provided
Just now You
Pic
Pic
Brian Cox Just now
Right before vacation season we have the next Big Deal for you.

Explore Metronic

Demo1

Demo2

demo
Coming soon

Demo3

demo
Coming soon

Demo4

demo
Coming soon

Demo5

Demo6

demo
Coming soon

Demo7

demo
Coming soon

Demo8

demo
Coming soon

Demo9

demo
Coming soon

Demo10

demo
Coming soon

Demo11

demo
Coming soon

Demo12

demo
Coming soon

Demo13

demo
Coming soon

Demo14

demo
Coming soon

Demo15

demo
Coming soon