The approach that I have used goes something like this:
App.Layers = {
streets: new OpenLayers.Layer....,
zones: new OpenLayers.Layer....
}
App.Stores = {
streets: new GeoExt.data.FeatureStore({layer:App.Layers.streets,....}),
zones: new GeoExt.data.FeatureStore({layer:App.Layers.zones,....}),
featTypes: new Ext.data.ArrayStore({
   fields:['name','key'],
   data:[['Streets','streets'],['Restricted Areas','zones']]
})
}
App.ColModels = {
streets: new Ext.grid.ColumnModel({  .....  }),
zones: new Ext.grid.ColumnModel({  .....  })
}
//assume we have a GeoExt.MapPanel (App.Map), a GridPanel (App.FeatGrid) 
with an OpenLayers.Control.SelectFeature (App.FeatSelect)

var layerSelector = new Ext.form.ComboBox({
   store:App.Stores.featTypes,
   valueField:'key',
   displayField:'name',
   listeners:{
      select:function(combo,record,index){
         var key = record.get(combo.valueField);
         App.FeatGrid.reconfigure(App.Stores[key],App.ColModels[key]);
         App.FeatSelect.setLayer(App.Layers[key]);
         App.FeatGrid.selModel.bind(App.FeatSelect);
      }
   }
})

You can see that the select event of the combo box reconfigures the grid and 
the select feature control with your newly selected layer and associated 
store and column model.

Hope that helps somewhat

Matt Priour

From: truongxuan quang
Sent: Friday, March 18, 2011 9:58 AM
To: [email protected]
Subject: [Users] Combobox control Map layers & gridpanel


Dear list

Could you please let me know there is example or tutorial to create Combobox 
to control and switch between layers or grid panel of thematic map similar 
to this example http://api.geoext.org/1.0/examples/zoom-chooser.html but in 
this link it presented change only of map scale. Because I would to 
something similar to this example 
http://api.geoext.org/1.0/examples/feature-grid.html but for 3 layers, and I 
support to use combobox to control and switch among layers.

Many Thanks

Quang






_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users 

_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to