[Users] GeoExt.AttributeStore question

Andrew Stewart Andrew.Stewart at reddeer.ca
Thu Oct 14 16:05:50 CEST 2010


Thanks for your suggestion once again. I tried to modify the displayField to 'name' and also 'type' but unfortunately I'm still getting nothing to show up when clicking on the combo box. It says loading... Below it for a brief second but nothing actually shows up, could this be a firewall or something? Maybe I should try a featurestore instead with an added WFS layer, I will look into that and post if I can make it work, thanks again for your suggestions. 

Here is what I tried - 


 var neighbourhood_store = new GeoExt.data.AttributeStore({
    url: "http://localhost/RedWFS/request.aspx?REQUEST=describeFeatureType&SERVICE=WFS&version=1.1.0&typename=Neighbourhoods"
    });
    
 
  //Type dropdown 
 var neighbourhoodCombo = new Ext.form.ComboBox({ 
     fieldLabel: 'Neighbourhood Name', 
     store: neighbourhood_store,
     valueField: 'name',
     emptyText: 'Pick a neighbourhood ...',
     displayField: 'name'
 }); 
  
var neighbourhoods = [{
        bodyStyle: 'padding-right:5px;',
        items: {
            xtype: 'fieldset',
            title: 'Neighbourhood Search',
            autoHeight: true,
            defaultType: 'checkbox', // each item will be a checkbox
            items: [neighbourhoodCombo]
        }
   
    }]; 


-----Original Message-----
From: Eric Lemoine [mailto:eric.lemoine at camptocamp.com] 
Sent: October 14, 2010 12:59 AM
To: Andrew Stewart
Cc: users at geoext.org
Subject: Re: [Users] GeoExt.AttributeStore question

On Wed, Oct 13, 2010 at 9:25 PM, Andrew Stewart
<Andrew.Stewart at reddeer.ca> wrote:
> I am trying to use a GeoExt.data.attribute store to populate the data field
> of an ext.form.combobox. I have tried to debug using firebird etc to see
> stuff inside neighbourhood_name_store below but it doesn't seem to be
> working properly. When I actually copy the request URL it performs the
> request correctly and I am trying to put the data field as the attribute
> from the request which is like-
>
> - <xs:complexType name="NeighbourhoodsType">
> - <xs:complexContent>
> - <xs:extension base="gmgml:NeighbourhoodsSubType">
> - <xs:sequence>
>   <xs:element name="NEIGHBOURHOODID" type="xs:int" />
>   <xs:element name="NEIGHBOURHOOD_NAME"
> type="gmgml:Neighbourhoods_NEIGHBOURHOOD_NAMEType" minOccurs="0" />
>   <xs:element name="LABEL_LINE1" type="gmgml:Neighbourhoods_LABEL_LINE1Type"
> minOccurs="0" />
>   <xs:element name="LABEL_LINE2" type="gmgml:Neighbourhoods_LABEL_LINE2Type"
> minOccurs="0" />
>   <xs:element name="LABEL_LINE3" type="gmgml:Neighbourhoods_LABEL_LINE3Type"
> minOccurs="0" />
>   <xs:element name="YearBuilt" type="gmgml:Neighbourhoods_YearBuiltType"
> minOccurs="0" />
>   <xs:element name="Geometry"
> type="gmgml:Polygon_Surface_MultiSurface_CompositeSurfacePropertyType"
> minOccurs="0" />
>   </xs:sequence>
>   </xs:extension>
>   </xs:complexContent>
>   </xs:complexType>
>
>
> Not sure why but it doesn't seem to be working, appreciate any assistance.

Some comments below.

>
> var neighbourhood_name_store = new GeoExt.data.AttributeStore({
>     url:
> "http://localhost/RedWFS/request.aspx?REQUEST=describeFeatureType&SERVICE=WFS&version=1.1.0&typename=Neighbourhoods"
>     });
>
>     neighbourhood_name_store.load();

In your case you need not load the store yourself, the combobox will
load it when needed.

>
>     alert(neighbourhood_name_store.feature);

Your AttribureStore doesn't work with a feature, so you shouldn't
expect store.feature to be defined. Binding a feature to an
AttributeStore corresponds to a specific use of AttributeStore.

>
>   //Type dropdown
> var neighbourhoodCombo = new Ext.form.ComboBox({
>      fieldLabel: 'Neighbourhood Name',
>      boxMaxWidth: 159,
>      name: 'neighbourhood_Name',
>      hiddenName: 'NEIGHBOURHOOD_NAME',
>      forceSelection: true,
>      store:neighbourhood_name_store,
>      valueField: 'NEIGHBOURHOOD_NAME',
>      emptyText: "NEIGHBOURHOOD_NAME",
>      displayField: "NEIGHBOURHOOD_NAME",
>      selectOnFocus: true
>      });

You cannot set valueField, emptyText and displayField to
"NEIGHBOURHOOD_NAME". The AttributeStore stores attribute records,
whose fields are "name", "type", etc (edit AttributeStore.js and
AttributeReader.js for more information). I think you may want to set
these properties to "name" instead.

Hope it helps,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


[This message has been scanned for security content threats and viruses.]

[The City of Red Deer I.T. Services asks that you please consider the environment before printing this e-mail.]






More information about the Users mailing list