[ka-Map-users] ka-Map map file list bug

Paul Spencer pspencer at dmsolutions.ca
Thu Jan 19 13:52:24 EST 2006


committed to cvs.

Paul


On 19-Jan-06, at 12:22 PM, David Badke wrote:

> In the CVS version of ka-Map the "select a map" list (the SELECT  
> tag) does not get populated with a list of the maps defined in  
> config.php ($aszMapFiles array). This array is copied into the  
> aMaps array in the addmap function, with the statement
>
> this.aMaps[oMap.name] = oMap;  [line 1548]
>
> which creates a JavaScript associative array object element because  
> oMap.name is a string. Later, in the myInitialized() function  
> (startUp.js), the aMaps array is loaded into the OPTION tags for  
> the SELECT list (around line 86):
>
>    for(var i=0; i < aMaps.length; i++) {
>     oSelect[j++] = new Option(aMaps[i].title,aMaps 
> [i].name,false,false);
>    }
> However, since the aMaps array was loaded as an associative array,  
> aMaps.length is always zero (which is imo is rather odd, but it is  
> true at least in Firefox and IE), so the loop never executes. The  
> loop should be coded as:
>
>    for(var i in aMaps) {
>     oSelect[j++] = new Option(aMaps[i].title,aMaps 
> [i].name,false,false);
>    }
>
> This loops through every element in aMaps, without needing the  
> length, and the map list is loaded properly.
>
> David
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
>

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+






More information about the ka-Map-users mailing list