[Users] Rendering feature attributes to combobox

Andreas Hocevar ahocevar at opengeo.org
Tue Sep 14 11:33:49 CEST 2010


Hi,

you may want to ask this on Sencha's Ext forum. But I am not aware of a way to reconfigure a combo box to use a different store. With a grid, however, this would be possible - there is a method called reconfigure.

Regards,
Andreas.

On Sep 13, 2010, at 15:33 , Evans, Barry wrote:

> Hi there I was wondering if someone could give me some advice on a problem I am having populating a combobox in GeoExt.
>  
> First of all I have feature attribute store of my data given by the following code called in when the page initialises:
>  
> layer_attribute_store = new GeoExt.data.AttributeStore({
>        url: "http://localhost:8080/geoserver/wfs?service=wfs&version=1.1.0&request=DescribeFeatureType&typeName=cite:USA"
>                                   });
>  
>     layer_attribute_store.load();
>  
>  
>  
> This store is then loaded into a combobox defined below:
>  
>  
> var themeCriteria = new Ext.form.ComboBox({
>                                                
>                                                 fieldLabel: 'Criteria',
>                                                 width: 130,
>                                                 id: 'criteriaId',
>                                                 name: 'criteria',
>                                                 hiddenName: 'criteria',
>                                                 forceSelection:true,
>                                                 editable:false,
>                                                 triggerAction: 'all',
>                                                 mode: 'local',
>                                                 store: layer_attribute_store,
>                                                 valueField: 'name',
>                                                 emptyText: "Name",
>                                                 triggerAction: "all",
>                                                 displayField: "name"
>  
>                                                 });
>  
> The combobox is then placed in a panel within a Viewport using normal apporach and placing in "items" catagory:
>  
>  
>                                                                                 items: [themeCriteria,SomethingElse1,SomethingElse2]
>  
>  
> This all works fine and it displays the attributes within the layer. Later however I want the use to be able to click on a radio button to change the layer name and subsequently update the combobox with the new layer attributes. Now I can get the layer name to change using the listner method in the layertree as shown in the examples and I can update the layer_attribute_store using the following:
>  
>    layer_attribute_store = new GeoExt.data.AttributeStore({
>          url: "http://localhost:8080/geoserver/wfs?service=wfs&version=1.1.0&request=DescribeFeatureType&typeName=" + node.layer.name
>         
>     });
>                                                                                                
>                 layer_attribute_store.load();
>  
>  
> For the life of me, however, I cannot get this new store to render into the combobox that is already created? I'm guessing there should be a simple piece of code that would just refresh the contents of the combobox accordingly but I've been searching online and trying different ways now for 2 weeks and still at a loss to a solution. If anyone has any ideas how to solve this it would be a great help.
>  
> Thank you.
>  
> Kind regards,
>  
> Barry
>  
> Email:    be208 at exeter.ac.uk
>  
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list