PDA

View Full Version : Combo does not query again for the same text.



nayak14
29 Sep 2009, 10:41 PM
Hi,
I am using combo with the autocomplete feature. min text length is set to 3 chars.
when i first time search it queries and bring the relevant data matching the text.
next time it works for same text since store has the records.

now i clear the store for some reason and again try to search with the same text, it doesnt query to bring the records.

what needs to be reset?

any clue?

Animal
29 Sep 2009, 11:51 PM
Show code

nayak14
30 Sep 2009, 5:18 AM
new Ext.form.ComboBox({
id:'appNameSearch',
name:'appNameSearch',
nowrap: true,
store: a2rm.application.gridlist.store,
displayField:'name',
fieldLabel: 'Search',
emptyText : 'Search app name...',
forceSelection: true,
valueField:'id',
typeAhead: true,
loadingText: 'Searching...',
width: 200,
listWidth:300,
pageSize:10,
minChars:3,
hideTrigger:true,
mode:'remote',
allowBlank: false,
selectOnFocus: true,
valueNotFoundText: '',
enableKeyEvents: true,
queryDelay: 1000,
listeners:{
select : this.loadAppDetails,
beforequery : function (evt)
{
if(this.getRawValue().length > 2)
{
//alert('/ARM/API/applications/?qbw='+this.getRawValue());
this.store.proxy.setUrl( '/ABC/XYZ/apps/?qbw='+this.getRawValue()) ;
}
else
return false;
}
}
})

qbw id query begins with which is interpreted by the service to return the results.

Thanks!!

nayak14
30 Sep 2009, 5:19 AM
new Ext.form.ComboBox({
id:'appNameSearch',
name:'appNameSearch',
nowrap: true,
store: xyz.application.gridlist.store,
displayField:'name',
fieldLabel: 'Search',
emptyText : 'Search app name...',
forceSelection: true,
valueField:'id',
typeAhead: true,
loadingText: 'Searching...',
width: 200,
listWidth:300,
pageSize:10,
minChars:3,
hideTrigger:true,
mode:'remote',
allowBlank: false,
selectOnFocus: true,
valueNotFoundText: '',
enableKeyEvents: true,
queryDelay: 1000,
listeners:{
select : this.loadAppDetails,
beforequery : function (evt)
{
if(this.getRawValue().length > 2)
{
this.store.proxy.setUrl( '/ABC/XYZ/apps/?qbw='+this.getRawValue()) ;
}
else
returnfalse;
}
}
})

qwb is our application specific param for the webservice it means "query starts with"

Animal
30 Sep 2009, 9:39 AM
You're going to need to format that before anyone reads it.

No color tags, no font tags, just
... tags round it.

nayak14
30 Sep 2009, 10:48 PM
why no color codes?

Animal
30 Sep 2009, 11:27 PM
why color codes?

nayak14
1 Oct 2009, 12:40 AM
done!

Animal
1 Oct 2009, 1:08 AM
I sometimes wonder what goes on here?

I know people don't read their own code, but just copy/paste any old thing they find on the interwebs, close their eyes tightly and wish for it to work.

But it also seems that people don't even glance at their own posts!

Nobody will attempt to read that code! You try it! Not easy is it?

mankz
1 Oct 2009, 1:33 AM
@Animal: Just updated my formatting bookmarklet (http://www.extjs.com/forum/showthread.php?p=393025#post393025) with selection support. You'll need it I think :)

nayak14
1 Oct 2009, 2:00 AM
new Ext.form.ComboBox({
id:'appNameSearch',
name:'appNameSearch',
nowrap: true,
store: xyz.application.gridlist.store,
displayField:'name',
fieldLabel: 'Search',
emptyText : 'Search app name...',
forceSelection: true,
valueField:'id',
typeAhead: true,
loadingText: 'Searching...',
width: 200,
listWidth:300,
pageSize:10,
minChars:3,
hideTrigger:true,
mode:'remote',
allowBlank: false,
selectOnFocus: true,
valueNotFoundText: '',
enableKeyEvents: true,
queryDelay: 1000,
listeners:{
select : this.loadAppDetails,
beforequery : function (evt)
{
if(this.getRawValue().length > 2)
{
this.store.proxy.setUrl( '/ABC/XYZ/apps/?qbw='+this.getRawValue()) ;
}
else
return false;
}
}
})


Hope this will help

Animal
1 Oct 2009, 2:13 AM
Do not use that beforequery listener.

Use the http://www.extjs.com/deploy/ext-3.0.0/docs/?class=Ext.form.ComboBox&member=queryParam

To find config options specific to a class, use

http://i131.photobucket.com/albums/p286/TimeTrialAnimal/hideinherited.jpg

nayak14
1 Oct 2009, 9:52 AM
I just added this.queryParam = '';
ot the beforeQuery code and it worked!!!

Thanks a lot!!

Animal
1 Oct 2009, 10:25 AM
Don't you understand?

You don't need that beforequery handler. Set the name of the parameter you want to use to carry the query string. Did you even click that link?

nayak14
8 Oct 2009, 1:23 AM
I set queryParam='qbw'
still the problem persist.
I will explain the whole scenario of my app.

first time, User search an application by its name.
combo quries for the text and shows all the application names starting with the entered text.
then when user goes to different link, i am clearing out the store of the combo.
next time user comes to the screen and searches for the same old text, combo doesnt query may be because its maintainig the last search text and shows whatever there in the associated store i.e. empty store in my case.
how can i reset the search of a combo?

Regards,
Harshad

manube
22 Jan 2010, 8:19 AM
Hello,
I've got the same problem than you : after 2 searches the query string is no more sent.
I get no error with firebug and when I listen to the key press events, it seems that typing content in the comboobx field doesn't throw any key press events (after 2 searches).

I suppose that I did something wrong, but I cannot find what.
Can you remember how you resolve your problem? (Otherwise I will create a new post with my code)

Thanks