-
2 May 2012 11:21 AM #1
How to Acess Store´s data by its own element
How to Acess Store´s data by its own element
[SOLVED]
Hi there ...
First, excuse me if my questions sounds stupid, but, im still learning about Ext Js and few topics are not clear yet.
Thats the scope (using extJs 4 )
I have a store like this:
And after load, o got a set of results like this:Code:this.siteStore = Ext.create('Ext.data.Store', { fields : ['id', 'name'], proxy : { type : 'ajax', actionMethods : 'GET', extraParams : {}, url : 'Sites/List/combo', reader : { totalProperty : 'length', type : 'json', root : 'rows' } } }),
The Question:Code:{"id":71,"name":"Israel"},{"id":57,"name":"Pakistan"},{"id":46,"name":"SWISS 0"},{"id":47,"name":"SWISS 1"},{"id":48,"name":"SWISS 2"},{"id":76,"name":"SWISS LX"},{"id":34,"name":"Tunisia"}
How do I get the 'id' when 'name' is equal (lets say), Pakistan ....
I tried to use:
But this only returns -1 or 1 ....Code:this.siteStore.find('name', this.fsite.getValue())
Thanks in advance !
DiegoLast edited by diegofavero; 3 May 2012 at 6:22 AM. Reason: Solved
-
2 May 2012 11:57 AM #2
Almost there
Almost there
if I use:
orCode:this.siteStore.getAt(this.siteStore.find('name', this.fsite.getValue())).id
I will get a value like this:Code:this.siteStore.findRecord('name', this.fsite.getValue()).id
which '67' is the value I want ...Code:Ext.data.Store.ImplicitModel-ext-gen1046-67
now, I could change my question :
How to split the wanted result ????
-
3 May 2012 6:17 AM #3
I got it ....
I got it ....
After almost 24h squizing my brain and the google, I could figure-out how to get the value I needed.
I just have to use:
this.siteStore.getAt(this.siteStore.findRecord('name',this.fsite.getValue()).index).data.id ....
A special thanks to nobody from this forum by help me out about this !!!!!


Reply With Quote