Happy New Year to All.
I have implemented a custom layer switcher using jqGrid since the OpenLayers LayerSwitcher does not contain enough relevant information for my clients. Like the original LayerSwitcher, I allow the user to toggle a layer's visibility on/off by checking/unchecking a checkbox. This works great in IE 9 and FireFox 17.0.1. However, in Chrome Version 23.0.1271.97 m any layer that is visible can be turned off, but when one check the checkbox to turn the layer back on, the map just displays the loading indicitor and never refreshes the map. The only way to redisplay the layer is to either zoom or pan the map.
Here is the code snippet that makes layers visible or not:
$('.jqgrow td input').each(function (a, b, c, d) {
$(this).click(function () {
var rowId = $(this).parents('tr')[0].rowIndex;
var layerName = $('#layerGrid').jqGrid('getCell', rowId, 'Layer Name');
var visibility = ($('#layerGrid').jqGrid('getCell', rowId, 'Visible') === "true" ? true : false);
var index = parseInt($('#layerGrid').jqGrid('getCell', rowId, 'Index'));
var layer = Globals.clientMap.layers[index]; <------ clientMap = Map1.GetOpenLayersMap()
if (layer !== undefined & layer !== null) {
layer.setVisibility(visibility);
}
});
});
Any help is greatly appreciated.
Chris