[Users] Reonfiguring feature grid by clicking on points?

Ivan Pašić ivanpasic.zd at gmail.com
Thu Apr 25 00:53:37 CEST 2013


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


More information about the Users mailing list