[Users] GeoExt.grid.FeatureSelectionModel
Minika Bjørge
Minika.Bjorge at statkart.no
Tue Dec 22 02:57:17 CET 2009
Hi,
I have 4 KML layers on my map and I have followed the Feature selection model to create 4 grid panels that sync with each of the layers (see screenshot).
However, I would like the grid panel to be visible only when the layer is selected i.e. the grid should be visible only for the active layer. I don't know how to do this. The way it is now, all the grid panel are expanded when the map loads. Is it possible to show the panel only when the layer is selected OR is it possible to expand the panel when the layer is selected (i.e. all the panels are collapsed by default)
I have looked at the LegendPanel example but I am still not clear how to make this work with the feature info in the grid panels.
Here's a cut down version of my code and a screen shot(I have manually collapsed the grid panels):
//Add the layers to map
map.addLayer(layer2);
map.addLayer(europa);
map.addLayer(layer);
map.addLayer(layer3);
//KML layers
map.addLayer(aarsmaks);
map.addLayer(aarsmin);
map.addLayer(kmlLayer);
map.addLayer(middel);
//Map controls
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MousePosition());
selectControl = new OpenLayers.Control.SelectFeature(
[kmlLayer, aarsmaks, aarsmin, middel],
{
clickout: true, toggle: false,
multiple: false, hover: false,
toggleKey: "ctrlKey", // ctrl key removes from selection
multipleKey: "shiftKey" // shift key adds to selection
}
);
map.addControl(selectControl);
selectControl.activate();
//Grid panel for KML layers
store.load();
store2.load();
store3.load();
store4.load();
box= new Ext.grid.GridPanel({
title: 'Vannstandsstasjoner',
store: store,
columns: [{heading: 'Sted', dataIndex: 'name'}],
region: "west",
width: 200,
height: 170,
border: false,
collapsible: true,
collapseMode: "mini",
allowDrag: true,
allowDrop: true,
draggable: true,
autoScroll: true,
sm: new GeoExt.grid.FeatureSelectionModel()
});
box2= new Ext.grid.GridPanel({
title: 'Årsmaksima',
store: store2,
columns: [{heading: 'Sted', dataIndex: 'name'}],
region: "west",
width: 200,
height: 170,
border: false,
collapsible: true,
collapseMode: "mini",
allowDrag: true,
allowDrop: true,
draggable: true,
autoScroll: true,
sm: new GeoExt.grid.FeatureSelectionModel()
});
box3= new Ext.grid.GridPanel({
title: 'Årsminima',
store: store3,
columns: [{heading: 'Sted', dataIndex: 'name'}],
region: "west",
width: 200,
height: 170,
border: false,
collapsible: true,
collapseMode: "mini",
allowDrag: true,
allowDrop: true,
draggable: true,
autoScroll: true,
sm: new GeoExt.grid.FeatureSelectionModel()
});
box4= new Ext.grid.GridPanel({
title: 'Årsmiddel',
store: store4,
columns: [{heading: 'Sted', dataIndex: 'name'}],
region: "west",
width: 200,
height: 170,
border: false,
collapsible: true,
collapseMode: "mini",
allowDrag: true,
allowDrop: true,
draggable: true,
autoScroll: true,
sm: new GeoExt.grid.FeatureSelectionModel()
});
//Map layout - north, west and center regions
var viewport = new Ext.Viewport({
layout:'border',
width:880,
height:610,
items:[
{
region: 'west', //contains the layer tree node and the feature grid for each layer
id: 'west-panel',
title: 'Tema',
width: 200,
minSize: 200-50,
maxSize: 200+50,
margins: '0 0 0 0',
collapsible: true,
collapseMode: 'mini',
border: true,
items: [tree,box,box2,box3,box4]
},{
region: 'center', //contains the map
id: 'center-panel',
title: 'Kart',
margins: '0 0 0 5',
collapsible: false,
height:610,
border:true,
items: [mapPanel]
}]
});
Many thanks for your help.
Minika Bjørge
Statens Kartverk Sjø
minika.bjorge at statkart.no
<http://www.statkart.no/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20091222/cc3d874d/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 3052 bytes
Desc: image001.jpg
Url : http://www.geoext.org/pipermail/users/attachments/20091222/cc3d874d/attachment-0001.jpeg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: map.jpg
Type: image/jpeg
Size: 37561 bytes
Desc: map.jpg
Url : http://www.geoext.org/pipermail/users/attachments/20091222/cc3d874d/attachment-0001.jpg
More information about the Users
mailing list