PDA

View Full Version : Get a value from an arraystore using double conditions



taomorpheus
7 Apr 2010, 9:43 AM
Hi,
I am new to the community, but i am following the forum from a bit.

I REALLY need some info about query(or filters) on Store class, because I am writing a widget that needs to display a value in a progressbar.

Only one value for each progressbar.


That's my Store (it's an example, i get these values from a json formatted source given by a php script):


LCombo.values = [
['P1','w', 124],
['P1','t', 43],
['P2','w', 483],
['P2','t',22],
['P3','w', 124],
['P3','t', 43],

];

var storeBars = new Ext.data.ArrayStore({
fields:['cid','type', 'value']
,data:LCombo.values
})


In poor words I need something as: Select value from storeBars WHERE Cid='p1' AND type='t', that returns ONLY one value.

I need to display that value in the bar in this way:


var ValueFromStore= XXXXXX;
pbar1.updateProgress(ValueFromStore/800, ' w/h ' + ValueFromStore + ' of '+80+'...')


I don't how to get it! May i need "query" function? Or some filter with a specific regular expression? I tryed a lot of things, so many complex ways that I lost my mind! What is the easiest way to resolve it?


Thanks, and sorry for my bad english :>

taomorpheus
8 Apr 2010, 1:05 AM
up!


(sorry I really need that :( )

Animal
8 Apr 2010, 2:31 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.data.Store&member=findBy

taomorpheus
8 Apr 2010, 6:18 AM
thanks, I knew that was easy xD damn :)