<div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:18px;background-color:rgba(248,248,248,0.6)">
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.</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:18px;background-color:rgba(248,248,248,0.6)">
The small part of code for it is here (it's just example for one layer):</p><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:12px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-color:rgb(238,238,238);color:rgb(51,51,51);line-height:18px">
<code style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;color:rgb(34,34,34)">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);
}
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:18px;background-color:rgba(248,248,248,0.6)">
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.</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:18px;background-color:rgba(248,248,248,0.6)">
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.</p>
</div>