Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using Openlayers and Geoext to create my web gis. I used Geoext to define panels in my viewport (mapPanel, treePanel, Feature table,..). 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.

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.