|
Lines 612-617
Link Here
|
| 612 |
], |
612 |
], |
| 613 |
pagingType: "full_numbers", |
613 |
pagingType: "full_numbers", |
| 614 |
}); |
614 |
}); |
|
|
615 |
let table_dt = table.DataTable(); |
| 615 |
|
616 |
|
| 616 |
$("#del_form").on("click", ".delete_news", function (e) { |
617 |
$("#del_form").on("click", ".delete_news", function (e) { |
| 617 |
e.preventDefault(); |
618 |
e.preventDefault(); |
|
Lines 632-663
Link Here
|
| 632 |
|
633 |
|
| 633 |
$("#show_expired").on("change", function () { |
634 |
$("#show_expired").on("change", function () { |
| 634 |
/* redraw the DataTable according to the custom search function */ |
635 |
/* redraw the DataTable according to the custom search function */ |
| 635 |
table.draw(); |
636 |
table_dt.draw(); |
| 636 |
}); |
637 |
}); |
| 637 |
|
638 |
|
| 638 |
table.on("search.dt", function () { |
639 |
table_dt.on("search.dt", function () { |
| 639 |
var term = table.search(); |
640 |
var term = table_dt.search(); |
| 640 |
$("#news_keyword").val(term); |
641 |
$("#news_keyword").val(term); |
| 641 |
}); |
642 |
}); |
| 642 |
|
643 |
|
| 643 |
$("#news_keyword").on("keyup", function () { |
644 |
$("#news_keyword").on("keyup", function () { |
| 644 |
var term = $(this).val(); |
645 |
var term = $(this).val(); |
| 645 |
filterDataTable(table, null, term); |
646 |
filterDataTable(table_dt, null, term); |
| 646 |
}); |
647 |
}); |
| 647 |
|
648 |
|
| 648 |
$("#news_display_location").on("change", function () { |
649 |
$("#news_display_location").on("change", function () { |
| 649 |
var term = $(this).val(); |
650 |
var term = $(this).val(); |
| 650 |
filterDataTable(table, 1, term); |
651 |
filterDataTable(table_dt, 1, term); |
| 651 |
}); |
652 |
}); |
| 652 |
|
653 |
|
| 653 |
$("#news_library").on("change", function () { |
654 |
$("#news_library").on("change", function () { |
| 654 |
// Table must be filtered by the <option>'s text, not its value |
655 |
// Table must be filtered by the <option>'s text, not its value |
| 655 |
var opt = $(this).find("option:selected").text(); |
656 |
var opt = $(this).find("option:selected").text(); |
| 656 |
filterDataTable(table, 2, opt); |
657 |
filterDataTable(table_dt, 2, opt); |
| 657 |
}); |
658 |
}); |
| 658 |
|
659 |
|
| 659 |
$(".dt_button_clear_filter").on("click", function () { |
660 |
$(".dt_button_clear_filter").on("click", function () { |
| 660 |
table.search("").columns().search("").draw(); |
661 |
table_dt.search("").columns().search("").draw(); |
| 661 |
$("#news-filter select").each(function () { |
662 |
$("#news-filter select").each(function () { |
| 662 |
$(this).val(""); |
663 |
$(this).val(""); |
| 663 |
}); |
664 |
}); |
| 664 |
- |
|
|