2

We are using the LiveSearchGrid Panel in ExtJS 4.2.1 similar to the example below, with Pagination. When the user searches for a record in one page, and then goes to another page, the search text field is NOT cleared, and clicking on the next or previous buttons show some random results (which are based the previous search). How can I clear this Search Text Field in the LiveSearchGridPanel?

http://dev.sencha.com/deploy/ext-4.0.1/examples/grid/live-search-grid.html

I looked into the API documentation of LiveSearchGridPanel, but it does not provide an easy handle to the Search Text Field.

Optimus Prime
  • 6,817
  • 5
  • 32
  • 60
Ravi
  • 843
  • 2
  • 15
  • 31
  • include some code maybe? what do you mean by another page? shouldn't you be able to just do: `searchvalue: null` like in initialization? – Vogel612 Aug 21 '13 at 14:30
  • Don't be confused with the pagination. I have a 'pagingtoolbar' as one of my docked items in the Grid. All I am intrested in is how to get an handle to the SearchValue in the LiveSearchGridPanel. I tried this which did not work. Ext.getCmp('LiveSearchGridPanelID').searchValue = null – Ravi Aug 21 '13 at 15:06

1 Answers1

2

Add a listener on the beforechange event of the paging toolbar. Something like this:

{
    xtype: 'pagingtoolbar',
    // ...
    listeners: {
        beforechange: function() {
            this.up('grid').down('textfield[name=searchField]').setValue('');
        }
    }
}
rixo
  • 23,815
  • 4
  • 63
  • 68