2012-09-29 4 views
1

중첩 목록에 검색 표시 줄을 추가하려고합니다. 검색 막대가 추가되고 console.log를 사용하여 시도 할 때 정상적으로 작동합니다. 찾고있는 레코드를 찾았지만 검색 결과 만 표시하려면 중첩 목록을 "새로 고치는"방법을 파악할 수 없습니다. "mystore.load()"를 사용하면 루트 노드로 다시 이동합니다.중첩 목록을 검색하는 방법

간단한

Ext.getCmp('yourNestedListID').goToNode(Ext.getStore('NestedListStore').findRecord('text', field.getValue())); 

트릭 희망이 다른 사람에게 도움이 될 수 있습니다 않았다

Ext.define('Sencha.controller.FileList', { 
     extend: 'Ext.app.Controller', 
     requires: [ 
        'Ext.MessageBox' 
        ], 
config: { 
     refs: { 
      homeBtn: 'button[iconCls=home]', 
      searchField: 'searchbar' 
     }, 

     control: { 
      'button[iconCls=home]': { 
       tap: 'onbtnHomeTap' 
      }, 
      'searchField' : { 
        action : 'onKeyUp' 
      }   
     } 
}, 



     onbtnHomeTap: function() { 
     console.log('bthome tapped'); 
     //reloads the list! 
      Ext.getCmp('myList').getStore().load(); 
     console.log(Ext.getCmp('searchfield').getValue()); 
     }, 
     onKeyUp: function(field) { 
       console.log('inside searchbar_event'); 
       /* this.doFilter({ 
        q: field.getValue() 
       });*/ 

      Ext.getStore('NestedListStore').findRecord('text', field.getValue()); 

     }, 

     /** 
     * @private 
     * Listener for the 'filter' event fired by the listView set up in the 'list' action. This simply 
     * gets the form values that the user wants to filter on and tells the Store to filter using them. 
     */ 
     doFilter: function(values) { 
     var store = Ext.getStore('NestedListStore'), 
     filters = []; 

     Ext.iterate(values, function(field, value) { 
        filters.push({ 
           property: field, 
           value : value 
           }); 
        }); 

     store.clearFilter(); 
     store.filter(filters); 
     store.load(); 
     } 
}); 

답변

1

좋아하는 사람들, 나는 내 자신의 질문에 대답했다.

+0

고마워요! 매력처럼 일했습니다! – LeoSarena

관련 문제