<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV>You would really need to put up a more complete example or a link to an
accessible version of the application, or at least a minimal example if the
below information doesn’t help</DIV>
<DIV> </DIV>
<DIV>Look at the documentation and examples on ExtJS combo box and the store
config option.</DIV>
<DIV> </DIV>
<DIV>First, you want to make sure that you are running ‘collect’ only after the
feature store is finished loading.</DIV>
<DIV>Second, when you use an array for the ‘store’ configuration option, you do
NOT include the ‘displayField’ & ‘valueField’ options. The combo
auto-creates a real store from the array and maps the correct field name to the
display & value options.</DIV>
<DIV> </DIV>
<DIV>Matt Priour</DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A
title=jorgelopez.physics@gmail.com
href="mailto:jorgelopez.physics@gmail.com">Jorge Lopez</A> </DIV>
<DIV><B>Sent:</B> Thursday, November 03, 2011 6:52 AM</DIV>
<DIV><B>To:</B> <A title=Users@geoext.org
href="mailto:Users@geoext.org">Users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> Re: [Users] Load combo, FeatureStore and filter
values</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">Thanks
Matt for your advice.
<DIV> </DIV>
<DIV>Anyway I didn`t succeed it. As you comment, first I should create an array
by using 'collect' method on combo's store. I got it by using an easy example of
an arraystore (static) but in my example, with data provided by an web service,
when I use collect method like this: </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>
<DIV>var combo1=new Ext.form.ComboBox({ </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>fieldLabel:'Filtro Pais', </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>name:'cmb-P', </DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>forceSelection:
true, </DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>store:
store2.collect('COUNTRY'), //store2 is my combo's store </DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>mode:
'local',<SPAN style="WHITE-SPACE: pre" class=Apple-tab-span> </SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>emptyText:'Select a country', </DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>triggerAction:
'all',</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>//allQuery:
'DISTINCT',</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>editable:false, </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>displayField:'COUNTRY', </DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>valueField:
'COUNTRY'</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN><SPAN
style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}); </DIV>
<DIV> </DIV>
<DIV>Nothing is appeared. I think that store is not loaded, so nothing can
happen but why I got it if collect is not used?</DIV>
<DIV> </DIV>
<DIV>I can figure out what is happening.</DIV>
<DIV> </DIV>
<DIV>Jorge</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV class=gmail_quote>On Wed, Nov 2, 2011 at 3:38 PM, Matt Priour <SPAN
dir=ltr><<A
href="mailto:mpriour@kestrelcomputer.com">mpriour@kestrelcomputer.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV>You’re going to want to use an ArrayStore for that “COUNTRY” combo box,
not the feature store.</DIV>
<DIV>If you use the feature store and filter unique countries, you will also
be filtering the grid.</DIV>
<DIV>Provide the array returned by the ‘collect’ method (<A
title=http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-collect
href="http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-collect"
target=_blank>http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-collect</A>)
on the feature store to the ArrayStore’s loadData function.</DIV>
<DIV>Put a listener on the combo box for the ‘select’ event that uses the
selected value to filter the feature store is you want to limit feature
records by that value.</DIV>
<DIV>If you are just looking to do linked combos, and not do any filtering or
only filter after the user has made a series selections from linked combos,
then you should have the ‘select’ listener for the first combo box ‘query’ (<A
title=http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-query
href="http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-query"
target=_blank>http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-query</A>)
the feature store and either directly use the returned collection in the
linked child combo box(es) or further process the collection to unique values
for a simple array store backed combo box</DIV>
<DIV> </DIV>
<DIV>Matt Priour</DIV>
<DIV> </DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV><B>From:</B> <A title=jorgelopez.physics@gmail.com
href="mailto:jorgelopez.physics@gmail.com" target=_blank>Jorge Lopez</A>
</DIV>
<DIV><B>Sent:</B> Wednesday, November 02, 2011 5:22 AM</DIV>
<DIV><B>To:</B> <A title=users@geoext.org href="mailto:users@geoext.org"
target=_blank>users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> [Users] Load combo, FeatureStore and filter
values</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV>
<DIV></DIV>
<DIV class=h5>
<P class=MsoNormal>Hello everyone: </P>
<P class=MsoNormal> </P>
<P class=MsoNormal><SPAN lang=EN-GB>I am driving mad with this problem. I am
doing a web application with OpenLayers, ExtJs and GeoExt and the simple fact
to load values in a combo have become hard. </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB>Step1: I have defined a featurestore that
stores the records from a layer in Geoserver. No problem to load these items
in a GeoExt gridPanel. This store has been generated with this
code:</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB>----</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB>store = new
GeoExt.data.FeatureStore({</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
layer: wfslayer,</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
fields: [</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
{name: 'PLANT', type: 'string'},</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
{name: ‘COUNTRY’, type: ‘string’},</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
{name: ‘STATUS', type: 'string'},</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
{name: 'long', type:
'float'},
</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
{name: 'lat', type: 'float'},</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
],</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
proxy: new GeoExt.data.ProtocolProxy({</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
protocol: new OpenLayers.Protocol.WFS({</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
//version: "1.0.0",</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
srsName: 'EPSG:900913', </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
url: "<A href="http://localhost:8080/geoserver/wfs"
target=_blank>http://localhost:8080/geoserver/wfs</A>",</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
featureNS: '<A href="http://localhost:8080/wfs"
target=_blank>http://localhost:8080/wfs</A>',</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
featurePrefix: nomPrefix,</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
featureType: nomLayer,</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
geometryName: nomGeometry,</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
schema: <A
href="http://localhost:8080/geoserver/wfs?service=WFS&request=DescribeFeatureType&typename=lonlat22"
target=_blank>http://localhost:8080/geoserver/wfs?service=WFS&request=DescribeFeatureType&typename=lonlat22</A>"</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
})</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
}), </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
autoLoad: true</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
});</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB>--</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB>This store has records with fields
(COUNTRY) that contains repeated values and I would like to filter that store
by this field: COUNTRY. For that, I have created a ComboBox and I am trying to
show only “no repeated” values but no success. </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB>var combo1=new Ext.form.ComboBox({
</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
fieldLabel:'Filtro Pais', </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
name:'cmb-P', </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
forceSelection: true, </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
store: store, </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
emptyText:'Escoge un país', </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
triggerAction: 'all', </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
//allQuery: 'DISTINCT',</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
editable:false, </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
displayField:'COUNTRY', </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
valueField: 'COUNTRY' </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-GB>
}); </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB>This combo shows a list of all (repeated)
values from store. This a question of ExtJS forum but I would appreciate if
anyone knew how to filter it out. </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB>Once a country is selected from combo, I
would like to be shown the STATUS associated to that selected COUNTRY. This is
a question of anidated combos but I don’t know how to ‘featurefilter’ config
tag would be entered in this problem. </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB>Any ideas? </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB>Thanks in advanced</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-GB></SPAN> </P>
<P class=MsoNormal><SPAN lang=EN-GB>Jorge</SPAN></P></DIV></DIV>
<HR>
_______________________________________________<BR>Users mailing list<BR><A
href="mailto:Users@geoext.org" target=_blank>Users@geoext.org</A><BR><A
href="http://www.geoext.org/cgi-bin/mailman/listinfo/users"
target=_blank>http://www.geoext.org/cgi-bin/mailman/listinfo/users</A><BR></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV>
<DIV> </DIV></DIV>
<P>
<HR>
_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR></DIV></DIV></DIV></BODY></HTML>