فهرست منبع

FD3-672 update vista de paquetes

Espinoza Guillermo 6 سال پیش
والد
کامیت
07c2232fe0
1فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 7 3
      src/KeaBundle/Resources/views/Packet/list.html.twig

+ 7 - 3
src/KeaBundle/Resources/views/Packet/list.html.twig

@@ -26,8 +26,10 @@
         
     var on_connect = function(x) {
       id = client.subscribe("/queue/kea", function(m) {
-          if ($('#tbody tr').length >= max_packets) {
+          if (typeof $filter != 'undefined' && $filter != '' && $('#tbody tr').length >= max_packets) {
               $('#tbody td:not(:contains("' + $filter + '"))').last().parent('tr').remove();
+          } else if ( $('#tbody tr').length >= max_packets) {
+              $('#tbody tr:last').remove();
           }
 
           $('#tbody').prepend($("<tr>").append($('<td class="sonata-ba-list-field sonata-ba-list-field-text td-bordered">').text(m.body)));
@@ -49,11 +51,13 @@
     
     {# FILTRO #}
     
+    var $filter = '';
+    
     function filter()
     {
-        var $filter = $('#filter').val();
+        $filter = $('#filter').val();
         
-        if ($filter.length >= 3) {
+        if (typeof $filter != 'undefined' && $filter.length >= 3) {
             $('#tbody td:not(:contains("' + $filter + '"))').hide();
         } else {
             $('#tbody td').show();