PDA

View Full Version : Search field and paging toolbar work wrong together in some cases



Qtx
31 May 2011, 6:41 AM
Sorry. It is for ExtJS 4.0.1 please move!!!

Example. We are on the page 3 of the result set and we want to search something. The found results fit into one page. In that case the paging toolbar stays in the state

Page 3 of 1

and the grid is empty, although some results are there.

To solve this problem, small corrections in the SearchField.js are necessary.

Use

store.loadPage(1);

insted of

store.load();

If we are about to search, we do not need to keep the current page, the current page might be invalid at all for found results, an we can surely start the search reults with the first page.


onTrigger1Click : function(){
var me = this,
store = me.store,
proxy = store.getProxy(),
val;

if (me.hasSearch) {
me.setValue('');
proxy.extraParams[me.paramName] = '';
proxy.extraParams.start = 0;
store.loadPage(1);
me.hasSearch = false;
this.updateElementSizes(false);
me.triggerEl.item(0).setDisplayed('none');
me.doComponentLayout();
}
}, // onTrigger1Click

onTrigger2Click : function(){
var me = this,
store = me.store,
proxy = store.getProxy(),
value = me.getValue();

if (value.length < 1) {
me.onTrigger1Click();
return;
}
proxy.extraParams[me.paramName] = value;
proxy.extraParams.start = 0;
store.loadPage(1);

var hadSearch = me.hasSearch;
me.hasSearch = true;
me.triggerEl.item(0).setDisplayed('block');
if(!hadSearch) this.updateElementSizes(true);
me.doComponentLayout();
}, // onTrigger2Click

duleep
9 Oct 2014, 10:49 PM
i got the same issu