2016-10-13 4 views
2

내 라이브 검색 그리드 works fine하지만 다음 페이지를 클릭하거나 그리드에 관한 다른 작업을 수행 할 때 검색 그리드가 강조 용어 검색을 잃어 버리면 어떤 도움을받을 수 있습니까? 모든 페이지에서 검색어를 강조 표시하고 싶습니다. 감사합니다그리드 라이브 검색 extjs

내 코드의 조각 우는 소리

:

var pagingStore = Ext.create('Ext.data.Store', { 
    proxy: { 
     type: 'memory', 
     enablePaging: true 
    }, 
    remoteFilter: true, 
    pageSize: 5 
}), 
     remoteStore = Ext.create('Ext.data.Store', { 
      autoLoad: true, 
      proxy: { 
       type: 'ajax', 
       url: 'js/json/pagingStore.json', 
       reader: { 
        rootProperty: 'items' 
       } 
      }, 
      fields: ['name', 'email', 'phone', 'type'] 
     }); 
remoteStore.load(function() { 
    pagingStore.getProxy().setData(remoteStore.getRange()); 
    pagingStore.load(); 
}); 
var bbar = new Ext.PagingToolbar({ 
    store: pagingStore, //the store you use in your grid 
    displayInfo: true, 
    items: [ { 
      xtype: 'textfield', 
      name: 'searchField', 
      id: 'txtfield', 
      fieldLabel:'Search:', 
      labelAlign:'right', 
      emptyText:'search...', 
      width: 300, 
      listeners: { 
       change: { 
        fn: onTextFieldChange 
       } 
      } 
     } 
    ] 
}); 
bbar.down('#refresh').hide(); 
Ext.create('Ext.grid.Panel', { 
    height: 400, 
    title: 'Simpsons', 
    id: 'gridPanel', 
    store: pagingStore, 
    columns: [{ 
      text: 'Name', 
      dataIndex: 'name', 
      filterable: true 
     }, { 
      text: 'Email', 
      dataIndex: 'email' 
     }, { 
      text: 'Phone', 
      dataIndex: 'phone' 
     }, 
     { 
      text: 'Type', 
      dataIndex: 'type' 
     }], 
    bbar: bbar, 
    renderTo: Ext.getBody() 
}); 
+0

쇼 그리드 및 관련 코드 –

+0

나는 당신은'JS/JSON/pagingStore.json' 파일과 기능을'추가 할 수 있습니다 – Joy

+0

위 내 게시물을 편집 한 onTextFieldChange '? –

답변

1

그래서 난 내 자신의 질문에 대답, 내가 하이라이트() 메소드를 생성하고 컨테이너에 넣어했습니다 : 클릭 할 때마다 필드에 검색 입력 한 후, 하여 검색 조건에 강조 숙박 :)

cont.getEl().on({ 
     click: { 
      fn: highlight 
     } 
    });