2012-04-28 5 views
0

私のリストで検索しようとしていますが、私はdocs.sencha.comで検索リストの例を使用しましたが、検索機能は検索しません。私のプロジェクトでSearchListが機能しない

私はsearchfieldを定義した後でコードを表示します。

xtype: 'textfield', 
     docked: 'top', 
     placeHolder: 'Arama...', 
     //autoCapitalize: true, 
     // label: 'Anahtar Kelime', 
     labelWidth: '`', 
     listeners : { 
       scope.this, 
       keyup : function(field) {   
         var value = field.getValue(); 
         if (!value) { 
          Menius.filterBy(function() { 
           return true; 
          }; 
         } ;            
         else { 
          var searches = value.split(' '), 
          regexps = [], 
          i; 
          for(i=0; i< searches.lenght; i++) { 
            if(!searches[i]) 
             return; 
            regexps.push(new RegExp(searches[i], 'i')); 
          }; 
          Menius.filterBy(function(record){ 
          var matched = []; 
          for(i=0; i<regexps.lenght; i++) { 
           var search = regexps[i]; 
           if (record.get('label').match(search)) 
            matched.push(true); 
           else matched.push(false); 
          }; 


         if (regexps.length > 1 && matched.indexOf(false) != -1) { 
           return false; 
         } else { 
           return matched[0]; 
         } 
        }); 
       } 
     } 

私がしたいことは、検索フィールドに何かを入力すると、その単語に従ってリストをフィルタリングする必要があります。そのため、スペルミスの

答えて

0

、forループの両方で

lenght -> length 

から

変更。

enter image description here