[Users] Reonfiguring feature grid by clicking on points?
Barbara Philippot
bphilippot at orupaca.fr
Thu Apr 25 08:37:51 CEST 2013
Ivan,
When defining your gridPanel I think you have to set an existing
selectControl to the selection model like :
var gridPanel = new Ext.grid.GridPanel({
....
sm: new GeoExt.grid.FeatureSelectionModel({
selectControl:
map.getControlsByClass("OpenLayers.Control.SelectFeature")[0],
...
})
})
Your selectFeatureControl must be linked to multiple layers, and then you
can listen to featureselected event (or maybe beforefeatureselected event)
and according to feature's layerName apply your setLayer function.
Hope that can help.
Barbara
2013/4/25 Ivan Pašić <ivanpasic.zd at gmail.com>
> Hi, I have feature table that contains attributes for features on my map.
> I made it work that when user click on layer's name in the layer tree he
> gets attribute data in feature table for that layer. Then he can click on
> rows in the table to get highlighted points on map and other way too. I
> first needed to define store for every layer.
>
> The small part of code for it is here (it's just example for one layer):
>
> function setLayer(model, node) {
> if (node.text=='layer1_name'){
> viewport.featureGrid.store.unbind();
> viewport.featureGrid.getSelectionModel().unbind();
> viewport.featureGrid.reconfigure(
> store_layer1, //I've defined that store before
> column_layer1 ////I've defined that columns before
> );
> viewport.featureGrid.store.bind(layer1);
> viewport.featureGrid.getSelectionModel().bind(layer1);
> }
>
> It works fine. But if user click on some point on map that belongs to
> layer which is not currently selected (so the feature table doesn't contain
> that layer's data but another one's) nothing happens. I would like to know
> how to enable that that when user select any point he gets attribute data
> in the feature table for the layer in which that point belongs and that the
> row in the table for that point is highlighted. Is it even possible? I hope
> you understand my question.
>
> Note: I believe all I should do is add one extra condition in 'if loop'.
> Probably something to check if the selected point on map belongs to that
> layer. If it does then the featuredGrid should be reconfigured. So if I do
> it like that, it won't just work when you select layer's name but also when
> you select point on map of that layer. I just don't know how to write it
> good. I hope you can help me with it. Thank you.
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20130425/e6d9b7ff/attachment.htm
More information about the Users
mailing list