[Mapbender-dev] Re: [Mapbender] #120: replace ["..."] with dot notation in JS

Christoph Baudson (WhereGroup) christoph.baudson at wheregroup.com
Tue Oct 16 09:16:02 EDT 2007


To illustrate the difference, an example

Does not work with toJSONString()

        currentLayer.layer_style[count] = [];
        currentLayer.layer_style[count]["name"] = styleName;
        currentLayer.layer_style[count]["title"] = styleTitle;
        currentLayer.layer_style[count]["legendurl"] = styleLegendUrl;
        currentLayer.layer_style[count]["legendurlformat"] = 
styleLegendUrlFormat;


Does work

        currentLayer.layer_style[count] = [];
        currentLayer.layer_style[count]["name"] = styleName;
        currentLayer.layer_style[count]["title"] = styleTitle;
        currentLayer.layer_style[count]["legendurl"] = styleLegendUrl;
        currentLayer.layer_style[count]["legendurlformat"] = 
styleLegendUrlFormat;


May work, not tried (curly brackets in line 1)

        currentLayer.layer_style[count] = {};
        currentLayer.layer_style[count]["name"] = styleName;
        currentLayer.layer_style[count]["title"] = styleTitle;
        currentLayer.layer_style[count]["legendurl"] = styleLegendUrl;
        currentLayer.layer_style[count]["legendurlformat"] = 
styleLegendUrlFormat;


More information about the Mapbender_dev mailing list