这可以避免Basemap层(如Google Maps)和覆盖层(如WMS)出现在GeoExt图例面板中:
var legendPanel = new GeoExt.LegendPanel({
border: false,
filter: function(record){
if(!(record.getLayer().isBaseLayer) && (record.getLayer() instanceof OpenLayers.Layer.WMS)){
return true;
}
} });
问题是我需要过滤(即。没有显示)层的名字中有"beam",我试了试没有成功:
return record.getLayer().displayInLayerSwitcher == false && record.getLayer().name == '%beam%';
return record.getLayer().displayInLayerSwitcher == false &&
record.get("layer").name.indexOf("%beam%") == -1;
return record.get("layer").name.indexOf("%beam%") == -1;
欢迎任何提示
只要去掉"%"。使用
return record.getLayer().name.indexOf("beam") == -1;
不是return record.getLayer().name.indexOf("%beam%") == -1;