Skip to content

Instantly share code, notes, and snippets.

Created July 11, 2013 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5977990 to your computer and use it in GitHub Desktop.
Save anonymous/5977990 to your computer and use it in GitHub Desktop.
Ext.define('MyApp.controller.ReportController', {
extend: 'Ext.app.Controller',
config: {
refs: {
clientList: 'clientselection list',
searchField: 'searchformfield'
},
control: {
searchField: {
keyup: 'onSearchKeyUp',
clearicontap: 'onSearchClearIconTap'
}
}
},
filterClients: function (filterText, clientList) {
var clientStore = clientList.getStore();
if (filterText) {
clientStore.clearFilter();
clientStore.loadPage(1, {
params: {
filterString: this.getSearchField().getValue()
}
});
} else {
clientStore.clearFilter();
clientStore.loadPage(1, {
params: {
filterString: ''
}
});
}
clientList.refresh();
},
onSearchClearIconTap: function (searchField, e, eOpts) {
this.filterClients(null, this.getClientList());
},
onSearchKeyUp: function (searchField, e, eOpts) {
this.filterClients(searchField.getValue(), this.getClientList());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment