瀏覽代碼

AMBARI-1158. Fiters are not working correctly on Hosts page. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431851 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 年之前
父節點
當前提交
a2d00e4b9e
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 1
      ambari-web/app/utils/data_table.js
  2. 1 0
      ambari-web/app/views/main/host.js

+ 2 - 1
ambari-web/app/utils/data_table.js

@@ -220,7 +220,8 @@ jQuery.extend($.fn.dataTableExt.afnFiltering.push(
         match = false;
         match = false;
         rowValue = (jQuery(rowValue).text()) ? jQuery(rowValue).text() : rowValue;
         rowValue = (jQuery(rowValue).text()) ? jQuery(rowValue).text() : rowValue;
         for (var i = 0; i < options.length; i++) {
         for (var i = 0; i < options.length; i++) {
-          if (rowValue.indexOf(options[i]) !== -1) match = true;
+          var str = new RegExp('(\\W|^)' + options[i] + '(\\W|$)');
+          if (rowValue.search(str) !== -1) match = true;
         }
         }
       }
       }
 
 

+ 1 - 0
ambari-web/app/views/main/host.js

@@ -46,6 +46,7 @@ App.MainHostView = Em.View.extend({
       "bSortCellsTop": true,
       "bSortCellsTop": true,
       "iDisplayLength": 10,
       "iDisplayLength": 10,
       "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
       "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
+      "oSearch": {"bSmart":false},
       "aoColumns":[
       "aoColumns":[
         { "bSortable": false },
         { "bSortable": false },
         { "sType":"html" },
         { "sType":"html" },