Sha256: 515fb2889880c85acbd2b53586857aa8aa884ad5fcedc0f5b27a1db41bf29665
Contents?: true
Size: 1.89 KB
Versions: 25
Compression:
Stored size: 1.89 KB
Contents
function datatable_list(table, ordered_columns, sorting, filter){ if (sorting == undefined){ var sorting = 0 } if (filter == undefined){ var filter = true } if (length == undefined){ var length = 50 } var asInitVals = new Array(); var remote = false if ($(table).data('source') != null) remote = true; var search = false if ($(table).data('search') != null) search = true; var notSortableColumns = [] var columnIndex = 0; $(table).find("th").each(function(index, item){ if(!$(item).data("sortable")) notSortableColumns.push(index); }); var oTable = $(table).dataTable({ "aoColumnDefs": [ { bSortable: false, aTargets: notSortableColumns } ] , "bFilter": filter, "bProcessing": remote, "bServerSide": remote, 'sAjaxSource': generateDataSource(table), "sPaginationType": "full_numbers", "iDisplayLength": length, "bRetrieve": true, "fnServerParams": function(){ $(".dataTables_processing").width($(".dataTable").width()); $(".dataTables_processing").height($(".dataTable").height() + 40); $(".dataTables_processing").html("<div class='datatables-loading'>Processando</div>") }, 'oLanguage': dataTablesTranslation }); if(!search) $(".dataTables_filter").hide(); } function generateDataSource(table){ var url = $(table).data('source'); url = addUrlParam(url, "scope", table); url = addUrlParam(url, "special_scope", table); url = addUrlParam(url, "from", table); url = addUrlParam(url, "to", table); url = addUrlParam(url, "advancedquery", table); return url; } function addUrlParam(url, param, table){ if($(table).data(param) != undefined && $(table).data(param) != ""){ if(url.indexOf("?") > 0) url = url + "&"; else url = url + "?"; return url + param + "=" + encodeURI($(table).data(param)); } else return url; }
Version data entries
25 entries across 25 versions & 1 rubygems