I am working on opensource can anyone help me in How to bind wms layers fields with store from geoserver to a combo box using geoext,extjs,openlayers and GeoServer?

I am facing problem in binding the attribute fields to a combo box.

In the below code i succeded in creating a kml layer binding to the combo box but what i need is i should bind wms layers from geoserver.I have 5 layers from geoserver and i have created them in one layer group but i am facing problem in binding wms layers to combo box.

var canalstore = new GeoExt.data.FeatureStore({ fields: [{ name: 'name', type: 'string'}] }); canalstore.bind(SCanal, { initDir: GeoExt.data.FeatureStore.LAYER_TO_STORE });

                var Canalcmb =Ext.create('Ext.form.ComboBox',
                         store: canalstore ,
                        id: 'Canalcmb',
                        xtype: 'combo',
                        forceSelection: true,
                        labelStyle: 'width:40px',
                        fieldLabel: 'AYACUT UNDER K.P.CANAL',
                        hideLabel: false,
                        region: 'east',
                        mode: 'local',
                        triggerAction: 'all',
                        queryMode: 'local',
                        valueField: 'name',
                        displayField: 'name',
                        editable: false,
                        listeners: {
                                select: function () {
                               //     alert('go')
                               SCanal.redraw({ force: true, interval: 100000 });
                                    if (Canalcmb.getValue != " ") {

                                     //   SCanal.refresh({ force: true});

                                        var selected_polygon_style = {
                                            graphicName: "circle",
                                            label: "${name}",
                                            pointRadius: 0.1,
                                            fillOpacity: 0.0,
                                            fillColor: "#0AADFF",
                                            strokeColor: "#F60FD3",
                                            strokeWidth: 5,
                                            strokeDashstyle: "longdash",
                                            'fillColor': "#0AADFF",
                                            'fillOpacity': 0.20,
                                            'fontColor': '#00FFFF',
                                            'fontFamily': 'arial, sans-serif',
                                            'fontSize': '0.99em'


                                        var feature = SCanal.features;

                                        for (var i = 0; i <= feature.length; i++) {

                                            if (feature[i].attributes.name == Canalcmb.getValue()) {

                                                var geom = feature[i].geometry;
                                                feature[i].style = selected_polygon_style;

                                                if (geom) {

                                            SCanal.redraw({ force: true, interval: 10000000 });
                                            Structurescombo.setValue("--All--");  // Canalcmb,villagecombo,Ayakattucombo,Structurescombo
                                            SVillages.redraw({ force: true });




enter image description here

  • What have you tried? For questions that involve code we ask that you show us where you are stuck with your own code by including a code snippet in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely.
    – PolyGeo
    Sep 16 '16 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.