[OpenLayers-Users] Internet Explorer doesn't refresh vector layer

fabiowebby fabiowebby at yahoo.it
Fri Aug 19 11:01:35 EDT 2011


Hi Guys,
I have a strange problem with IE that is driving me nuts and I really hope
that someone can help me. I have some earthquakes data coming out of the
database through php and is showed in a tabular manner. The results in the
table are paginated in an ajax way. everytime page results are shown, a
georss file is updated with the current page results so that openlayers can
read it and show just the current page results not all them at the same time
and assign different style for different earthquakes.

I have a page called pagination.php with the following code:


//file involved in ajax request and refresh



<div id="loading"></div>//div to show loading img

<div id="map" style="width:512px; height:256px; float:right;"></div>// map 

<div id="container">

<div class="data"></div>//table results are shown in here

<div class="pagination"></div>//pagination buttons are loaded in here

</div>

Also when pagination.php is called for the first time a map is created in
the body in the following way and the first 25 results are read from the
georss file:



Now in pagination.php I import a file called pagination.js that hosts
several jquery functions including the one for the ajax call.

//this function is used to extract get variables values from the url
function getUrlVars() {
				var vars = [], hash;
				var hashes = window.location.href.slice(
						window.location.href.indexOf('?') + 1).split('&');
				for ( var i = 0; i < hashes.length; i++) {
					hash = hashes[i].split('=');
					vars.push(hash[0]);
					vars[hash[0]] = hash[1];
				}
				return vars;
			}


//this function is involved in refreshing the vector layer but doesn't work
in IE
function refresh(){
				earthquakes.refresh({url:"files/georss.xml"});
				map.zoomToMaxExtent();
				
			}

//function to show loading img
function loading_show() {
				$('#loading').html(" images/loading.gif ").fadeIn(
						'fast');
			}

//funtion to hide loading img
function loading_hide() {
				$('#loading').fadeOut('fast');
			}

//function with ajax call to load data results in data div
function loadData(page) {

		loading_show();
			$.ajax( {
				type : "GET",
				url : "load_data.php",//file that queries database and outputs results
				//get variables taken from url and passed to load_data.php
                                data : "page=" + page + "&start=" +
getUrlVars()['start']
						+ "&end=" + getUrlVars()['end'] + "&minMagn="
						+ getUrlVars()['minMagn'] + "&maxMagn="
						+ getUrlVars()['maxMagn'],
				success : function(msg) {//if request is successful
					$("#container").ajaxComplete(
							function(event, request, settings) {
								loading_hide();//hide loading img 
								$("#container").html(msg);//send data to container div
							refresh();//refresh vector layer					
					});
				}
			});
		}
			loadData(1); // For first time page load default results
			
                       // defines how to send the number of page to loaddata
function
			$('#container .pagination li.active').live('click', function() {
				var page = $(this).attr('p');
				loadData(page);
				
			});
The result of all this shoulf be that the vector layer, where the georss
points are shown,should refresh every time the ajax request for a new page
results is successful. Now this arrangement works very well in Firefox and
georss with diffrent style are refreshed according to the current page
results. In IE the vector layer reads the file when the page is called for
the first time and then when I click for successive pages the map does not
refresh at all. Could anyone please help me with this? it is driving mental
because I don't understand why IE doesn't understand the refresh function.

Thank you very much in advance for your help.

Best Regards 
Fabio 


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Internet-Explorer-doesn-t-refresh-vector-layer-tp6703517p6703517.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list