JSFiddle - React, Tailwind, and code Playground

by inDiscover

HTML

<link rel="stylesheet" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css">
<script src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
<button onclick="fnClickAddRow()">Add Rows</button>
<table id="table_id" class="display">
    <thead>
        <tr>
            <th>Column 1</th>
            <th>Column 2</th>
        </tr>
    </thead>
    <tbody></tbody>
</table>

JavaScript

var giCount = 1;
jQuery(document).ready(function () {
    jQuery('#table_id').DataTable();
});

function fnClickAddRow() {
    alert("hh");
    jQuery('#table_id').dataTable().fnAddData([
    giCount + ".1",
    giCount + ".2", ]);

    giCount++;
}