[Users] Rendering feature attributes to combobox

Evans, Barry be208 at exeter.ac.uk
Fri Sep 10 11:14:25 CEST 2010


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]


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100910/723c27b3/attachment.htm 


More information about the Users mailing list