我已编辑此功能:
在代码的第一部分中,我显示了融合表中的折线。在seconde部分中,我想影响一个事件,点击以更改所选折线的样式,但他没有工作,他隐藏了所有折线..
function filterTC() {
var filter = [];
var j = document.getElementsByName('sousmenu4');
for (var i = 0, k; k = j[i]; i++) {
if (k.checked) {
filter.push('\'' + k.value + '\'');
}
}
if (filter.length) {
if (!layer3.getMap()) {
layer3.setMap(map);
}
layer3.setOptions({
query: {
select: 'geometry',
from: '1twRoA12Qc7toIRQe_Uk6XKFS8Ts-V_AvcHZahGlx',
where: '\'indice\' IN (' + filter.join(',') + ')',
},
options: {
styleId: 2,
templateId: 3
}
});
}
else {
layer3.setMap(null);
}
问题在于以下代码:
selected={};
google.maps.event.addListener(layer3, 'click', function(e) {
var val=e.row['name'].value,
vals=[];
//update the selected-object
selected[val]=(!selected[val])?true:false;
for(var l in selected){
if(selected[l]){
vals.push(l);
}
}
layer3.set("styles", [{
where: "'name' IN('"+vals.join("','")+"')",
polylineOptions: {
strokeColor: "#cc0000",
strokeWeight: "4" }
}]);
});
}
感谢您的帮助