I have a bunch of tracks on screen in a vector layer. I used some hover and select styles in the layer styleMap and these styles are properly triggered by:
var highlightCtrl = new OpenLayers.Control.SelectFeature(tbTrack.vector, {
hover: true,
highlightOnly: true,
renderIntent: "hover",
});
var selectCtrl = new OpenLayers.Control.SelectFeature(tbTrack.vector,
{clickout: true, renderIntent: "select"}
);
tbMap.map.addControl(highlightCtrl);
tbMap.map.addControl(selectCtrl);
highlightCtrl.activate();
selectCtrl.activate()
All these tracks are listed in a table under the map. I want to trigger the corresponding hover and select styles for a track if I click or hover on them in the table. How to do this?
I allready have the coupling between the table and the lines, I just don't know the right way to trigger the hover or select events.
Best Answer
This question has been answered before on stackoverflow:
https://stackoverflow.com/questions/8832029/how-to-select-a-feature-programmatically-on-a-vector-layer-in-openlayers