Jugadores líderes de SV SCORE en MyStatsOnline.com
$(document).ready(function () { init_datatables(); });
function init_datatables() {
$(".myDataTable:not([data-no-dt-init])").each(function (e) { var myButtons = [];
var myDataTable = $(this).DataTable({ bAutoWidth: true, scrollY: false, scrollX: true, scrollCollapse: true,
stateSave: !($(this).attr("show")) ? true : false, lengthMenu: [[10, 25, 50, 1000000], [10, 25, 50, "Todos"]], pageLength: !($(this).attr("show")) ? 10 : $(this).attr("show") == "-1" ? 1000000 : $(this).attr("show"),
/* dom: 'Bfrtip', buttons: 'excelHtml5', // myButtons, */
columnDefs: [ /* Sort */ { targets: 'players_name_col', type: 'locale-compare' }, { targets: 'sort-non-empty-string', type: 'non-empty-string' }, { targets: 'no-sort', sortable: false },
/* Change order sequence default to desc */ { targets: ['orderseq-desc'], orderSequence: ["desc", "asc"] }
],
"language": { "url": "../../../App_WebComponents/datatable/lang/es-MX.json" },
fixedColumns: { leftColumns: !($(this).attr("data-col-fix")) ? 0 : $(this).attr("data-col-fix") },
paging: !($(this).hasClass("nowidget")) && !($(this).hasClass("nopadging")), searching: !($(this).hasClass("nowidget")) && !($(this).hasClass("nosearching")), info: !($(this).hasClass("nowidget")) && !($(this).hasClass("nopadging")), ordering: !($(this).hasClass("nosorting")),
// Si toutes les rows sont affichés, enlever la pagination "fnDrawCallback": function (oSettings) { if (oSettings._iDisplayLength > oSettings.fnRecordsDisplay()) { $(oSettings.nTableWrapper).find(".dataTables_paginate").hide(); } else { $(oSettings.nTableWrapper).find(".dataTables_paginate").show(); }
}
});
//myDataTable.columns.adjust();
$(window).resize(function () { myDataTable.columns.adjust().draw(); });
// Add Row Number if ($(this).hasClass("rownumber")) {
// If average row exist, discard this row for row numbers /* var avgRowNode; var avgRow = myDataTable.row(".avg"); if (avgRow != null) { avgRowNode = avgRow.node(); avgRow.remove(); myDataTable.draw(); } */
myDataTable.on("order.dt search.dt", function () { var bAvgRow = false; myDataTable.column(0, { search: "applied", order: "applied" }).nodes().each(function (cell, i) { if (cell.classList.contains("avg")) { bAvgRow = true; cell.innerHTML = ""; } else { if (!bAvgRow) cell.innerHTML = i + 1; else cell.innerHTML = i; }
}); }).draw();
//myDataTable.draw();
//myDataTable.row.add(avgRowNode);
//myDataTable.draw(); }
// Add Row Number /* if ($(this).hasClass("rownumber")) { var bAvg = false; myDataTable.on('order.dt search.dt', function () { myDataTable.column(0, { search: 'applied', order: 'applied' }).search('-1').nodes().each(function (cell, i) { if (cell.innerHTML != "-1") if (!bAvg) cell.innerHTML = i + 1; else cell.innerHTML = i; else bAvg = true; }); }).draw(); } */
// Si il y a un tri autre que le défaut pour le classement, on cache le séparateur inclus/exclus des séries if ($(this).hasClass("datatable-standings")) { myDataTable.on('order.dt', function () { var order = myDataTable.order(); if (order[0][0] == 0 && order[0][1] == "asc") { $(this).find("> tbody > tr.standings_sep_disabled").each(function () { $(this).toggleClass("standings_sep_disabled standings_sep"); }); } else { $(this).find("> tbody > tr.standings_sep").each(function () { $(this).toggleClass("standings_sep standings_sep_disabled"); }); } //console.log('Ordering on column ' + order[0][0] + ' (' + order[0][1] + ')') }); }
})
}
// Fix pour le datatable quand dans un tab (hide/show). Utilisé par mso-tabs.js et mso-ddl-tabs.js function RefreshDataTable() { $($.fn.dataTable.tables(true)).DataTable() .columns.adjust() .responsive.recalc(); }
function getMaxWidth(sel) { max = 0; $(sel).each(function () { c_width = parseInt($(this).width()); if (c_width > max) { max = c_width; } }); return max; }
function init_tooltips() { $('[title]').each(function (e) { if ($(this).is('[placement]')) { $(this).tooltip({ container: 'body', toggle: 'toolip', html: 'true', placement: $(this).attr('placement') }); } else { $(this).tooltip({ container: 'body', toggle: 'toolip', html: 'true', placement: 'top' }); }
}); }
function pageLoad() { init_tooltips();
if (typeof contentPageLoad == 'function') contentPageLoad();
/* pour les pages qui utilise les tabs, comme dans go_mobile, ca permet de reload le current tab sur un reload ajax */ $(function () { var tabName = $("[id*=TabName]").val() != "" ? $("[id*=TabName]").val() : "info"; $('#Tabs a[href="#' + tabName + '"]').tab('show'); $("#Tabs a").click(function () { $("[id*=TabName]").val($(this).attr("href").replace("#", "")); }); });
}
function getPageName(url) { var index = url.lastIndexOf("/") + 1; var filenameWithExtension = url.substr(index); var filename = filenameWithExtension.split(".")[0]; return filename; }
Sys.Net.WebRequestManager.add_invokingRequest(onInvoke); Sys.Net.WebRequestManager.add_completedRequest(onComplete);
function onInvoke(sender, args) { if (theForm.__EVENTARGUMENT.value != "noprogress") { var modal = document.getElementById('myModalLoading'); modal.style.display = "block"; } }
function onComplete(sender, args) { var modal = document.getElementById('myModalLoading'); modal.style.display = "none"; }
function pageUnload() { Sys.Net.WebRequestManager.remove_invokingRequest(onInvoke); Sys.Net.WebRequestManager.remove_completedRequest(onComplete); }