ExtJS reset Search field
I am using a grid with a Grid Search plugin (http://extjs.eu/docs/?class=Ext.ux.grid.Search)
I keep hiding and showing this grid every time the user press a button. I would like to reset the search field of the plugin every time the grid i开发者_运维问答s displayed. What happens now is that the user clicks, the grid is shown and the user can search for something. The problem is that next time the user will click to make the grid visible, the search text will be the same as the old one, with the corresponding filter applied to the store.
Any hint about how to do that?
Best regards
I can actually answer myself here. You basically need to set the value of the field to '' and call a method to start the search
search.field.setValue(''); search.onTriggerSearch();
where search is defined like:
var search = new Ext.ux.grid.Search({...});
searchfield has the following function
onTrigger1Click : function(){
var me = this;
if (me.hasSearch) {
me.setValue('');
me.store.clearFilter();
me.hasSearch = false;
me.triggerCell.item(0).setDisplayed(false);
me.updateLayout();
}
},
so you can also run searchfield.onTrigger1Click();
精彩评论