4
var t = $("#t_add_row").DataTable();
7
$("#addRow").on("click", function () {
28
$(".datatable-select-inputs").DataTable({
29
initComplete: function () {
35
'<select class="form-select"><option value="">Select option</option></select>'
37
.appendTo($(column.footer()).empty())
38
.on("change", function () {
39
var val = $.fn.dataTable.util.escapeRegex($(this).val());
41
column.search(val ? "^" + val + "$" : "", true, false).draw();
48
.each(function (d, j) {
49
select.append('<option value="' + d + '">' + d + "</option>");
59
$(".text-inputs-searching tfoot th").each(function () {
60
var title = $(this).text();
62
'<input type="text" class="form-control" placeholder="Search ' +
69
var tableSearching = $(".text-inputs-searching").DataTable();
72
tableSearching.columns().every(function () {
75
$("input", this.footer()).on("keyup change", function () {
76
if (that.search() !== this.value) {
77
that.search(this.value).draw();
89
'<table class="table" cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
91
"<td>Full name:</td>" +
97
"<td>Extension number:</td>" +
103
"<td>Extra info:</td>" +
104
"<td>And any further details here (images etc)...</td>" +
113
var tableChildRows = $(".show-child-rows").DataTable({
114
ajax: "https://api.npoint.io/b9d05e59af5e9db4a3c2",
117
className: "details-control",
123
{ data: "position" },
133
$(".show-child-rows tbody").on("click", "td.details-control", function () {
134
var tr = $(this).closest("tr");
135
var row = tableChildRows.row(tr);
137
if (row.child.isShown()) {
140
tr.removeClass("shown");
143
row.child(format(row.data())).show();
144
tr.addClass("shown");
151
var table1 = $("#row_select").DataTable();
153
$("#row_select tbody").on("click", "tr", function () {
154
$(this).toggleClass("selected");
157
$("#button").click(function () {
158
alert(table1.rows(".selected").data().length + " row(s) selected");
165
var table2 = $("#form_inputs").DataTable();
167
$(".inputs-submit").click(function () {
168
var data = table2.$("input, select").serialize();
170
"The following data would have been submitted to the server: \n\n" +
171
data.substr(0, 120) +
180
var table3 = $("#sing_row_del").DataTable();
182
$("#sing_row_del tbody").on("click", "tr", function () {
183
if ($(this).hasClass("selected")) {
184
$(this).removeClass("selected");
186
table3.$("tr.selected").removeClass("selected");
187
$(this).addClass("selected");
191
$("#delete-row").click(function () {
192
table3.row(".selected").remove().draw(false);