function stopPropagation(evt) { if (evt.stopPropagation !== undefined) { evt.stopPropagation(); } else { evt.cancelBubble = true; } } $(function () { // open last opened treeview and sidebar-collapse if (typeof Cookies !== 'undefined') { var cookie_value = Cookies.get('sidebar-collapse'); if (cookie_value == 'true') { $("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu'); } var cookie_value = Cookies.get('treeview-open'); if (typeof cookie_value !== 'undefined') { $($('.sidebar-menu .treeview').get(cookie_value)).addClass('active'); } } //Initialize Select2 Elements $(".select2").select2(); $(".select2.readonly").select2({readonly: true}); tinymce_init(".editor", '100%', 300); //1.target element 2.width 3.height //Money Euro $("[data-mask]").inputmask(); //Date picker $('body').on('focus', '.datepicker, .datepicker1', function () { $(this).datepicker({ format: "yyyy-mm-dd", todayBtn: true, clearBtn: true, autoclose: true, todayHighlight: true }); }); var table = $('.datatable').DataTable({ "order": [], "language": { "url": "plugins/datatables/lang/" + datatable_lang + ".json" } }); $('.datatable-with-filter thead th:not(.no-filter)').each(function () { var title = $('.datatable-with-filter thead th').eq($(this).index()).text(); // console.log(title); if (title) { $(this).html(''); } }); // DataTable var datatable_with_filter = $('.datatable-with-filter').DataTable({ "order": [], "language": { "url": "plugins/datatables/lang/" + datatable_lang + ".json" } }); $("input.search_init, textarea.search_init").keyup(function(e){ e.stopPropagation(); // e.preventDefault(); }); if (datatable_with_filter.context.length) { // Apply the search datatable_with_filter.columns().eq(0).each(function (colIdx) { $('input', datatable_with_filter.column(colIdx).header()).on('keyup change', function () { datatable_with_filter .column(colIdx) .search(this.value) .draw(); }); }); } });