{% extends "base.html.twig" %} {% block localstyle %} {% endblock %} {% block body %}
{% endblock %} {% block localjavascript %} var table; function showhide() { categoryfilters=$("#filtercategorys").val(); repofilters=$("#filterrepos").val(); $.fn.dataTable.ext.search.push(function(settings, data, dataIndex, rowObj, counter) { el=table.row(dataIndex).nodes().to$(); category = $(el).data('category'); repo = $(el).data('repo'); toreturn=true; if(categoryfilters.length!==0 && jQuery.inArray(category.toString(), categoryfilters )<0) { toreturn=false; } if(repofilters.length!==0 && jQuery.inArray(repo.toString(), repofilters )<0) { toreturn=false; } return toreturn; }); table.draw(); //$.fn.dataTable.ext.search.pop(); } function filtercategorys() { $.ajax({ method: "POST", url: "{{ path('app_user_preference') }}", data: { key:'filtercategorys', id:0, value: $("#filtercategorys").val() } }); showhide(); } function filterrepos() { $.ajax({ method: "POST", url: "{{ path('app_user_preference') }}", data: { key:'filterrepos', id:0, value: $("#filterrepos").val() } }); showhide(); } $(document).ready(function() { $('#filtercategorys').select2(); {% if filtercategorys %} {% for category in filtercategorys %} $("#filtercategorys").val($("#filtercategorys").val().concat("{{category}}")); {%endfor%} $('#filtercategorys').trigger('change'); {% endif %} $('#filtercategorys').on("select2:select", function(e) { filtercategorys(); }); $('#filtercategorys').on("select2:unselect", function(e) { filtercategorys(); }); $('#filterrepos').select2(); {% if filterrepos %} {% for repo in filterrepos %} $("#filterrepos").val($("#filterrepos").val().concat("{{repo}}")); {%endfor%} $('#filterrepos').trigger('change'); {% endif %} $('#filterrepos').on("select2:select", function(e) { filterrepos(); }); $('#filterrepos').on("select2:unselect", function(e) { filterrepos(); }); table = $('#dataTables').DataTable({ columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], responsive: true, iDisplayLength: 100, order: [[ 1, "asc" ]], }); showhide(); }); {% endblock %}