4
$("#file_export").DataTable({
6
buttons: ["copy", "csv", "excel", "pdf", "print"],
9
".buttons-copy, .buttons-csv, .buttons-print, .buttons-pdf, .buttons-excel"
10
).addClass("btn btn-primary");
16
var table = $("#show_hide_col").DataTable({
21
$("a.toggle-vis").on("click", function (e) {
25
var column = $("#show_hide_col")
28
.column($(this).attr("data-column"));
30
column.visible(!column.visible());
36
$("#col_render").DataTable({
42
render: function (data, type, row) {
43
return data + " (" + row[3] + ")";
47
{ visible: false, targets: [3] },
54
var table = $("#row_group").DataTable({
56
columnDefs: [{ visible: false, targets: 2 }],
59
drawCallback: function (settings) {
61
var rows = api.rows({ page: "current" }).nodes();
65
.column(2, { page: "current" })
67
.each(function (group, i) {
72
'<tr class="group"><td colspan="5">' + group + "</td></tr>"
84
$("#row_group tbody").on("click", "tr.group", function () {
85
var currentOrder = table.order()[0];
86
if (currentOrder[0] === 2 && currentOrder[1] === "asc") {
87
table.order([2, "desc"]).draw();
89
table.order([2, "asc"]).draw();
96
$("#multi_control").DataTable({
97
dom: '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
103
var table = $("#dom_jq_event").DataTable();
105
$("#dom_jq_event tbody").on("click", "tr", function () {
106
var data = table.row(this).data();
107
alert("You clicked on " + data[0] + "'s row");
113
$("#lang_file").DataTable({
115
url: "../../assets/js/datatable/German.json",
123
$("#complex_head_col").DataTable({
140
$("#setting_defaults").dataTable($.extend(true, {}, defaults, {}));
145
$("#footer_callback").DataTable({
146
footerCallback: function (row, data, start, end, display) {
147
var api = this.api(),
151
var intVal = function (i) {
152
return typeof i === "string"
153
? i.replace(/[\$,]/g, "") * 1
154
: typeof i === "number"
163
.reduce(function (a, b) {
164
return intVal(a) + intVal(b);
169
.column(4, { page: "current" })
171
.reduce(function (a, b) {
172
return intVal(a) + intVal(b);
176
$(api.column(4).footer()).html(
177
"$" + pageTotal + " ( $" + total + " total)"
186
$("#custom_tool_ele").DataTable({
187
dom: '<"toolbar">frtip',
190
$("div.toolbar").html("<b>Custom tool bar! Text/images etc.</b>");
195
$("#row_create_call").DataTable({
196
createdRow: function (row, data, index) {
197
if (data[5].replace(/[\$,]/g, "") * 1 > 150000) {
198
$("td", row).eq(5).addClass("highlight");