PDA

View Full Version : How to access value sent to store.load() by ComboBox?



JakeL
13 Mar 2012, 1:48 PM
Hi All -

I'm certain that this is something I should be able to do, but I just can't quite find the right variable.

I am setting up a ComboBox to load data from a remote store. however, I can't easily use one of the built-in proxies (i.e. jsonp, ajax, etc) since I'm relying on some legacy code that takes care of the actual messaging. So, what I need to do is be able to figure out what value the ComboBox is sending to store.load(), that would normally be sent to the proxy.

I have extended Store, and have overridden the load() method, so I've got all the logic I need, I just can't figure out how to access what ComboBox is sending to store.load() that normally goes in the params and such I guess?




load: function ()
{
try
{
this.removeAll(); //clear the store...
var matches = AbstractItemSearch.runIntellisenseSearch(???); //how to get parm sent to store load from ComboBox?
var matchesArr = new Array();
for (var x = 0; x < matches.length; x++)
matchesArr[x] = Ext.create("ItemSearchModel", { itemNum: matches[x], itemDesc: 'Description...' });
this.add(matchesArr); //add all to the Store.
}
catch (e)
{
this.removeAll();
alert("Error getting items:" + e.description);
}
}

I tried looking for this.extraParams and such, but just couldn't quite find it. Is it there, or do I need to be looking somewhere else to figure out where ComboBox is sending the user-typed text on to the store for querying/loading?

Cheers,

-J

skirtle
13 Mar 2012, 2:15 PM
Take a look at doQuery:

http://docs.sencha.com/ext-js/4-0/source/ComboBox.html#Ext-form-field-ComboBox-method-doQuery

Specifically the call to store.load(...) should point you in the right direction.

JakeL
13 Mar 2012, 2:25 PM
Perfect, thank you, found what I needed: params.query :D

I'm new enough with ExtJS that I didn't notice the ability to check the source directly in the docs page like you linked - thank you. Teach a man to fish and all that ;-)

Cheers,

-Jake