Thanks for your input Marc!
Try exporting the mb_mapObj from Mapbender, it is incomplete.
It may fail because some objects are initialised as arrays, see
/javascripts/map_obj.js.
Maybe try your example with
var c = [];
instead of {}
I would be curious if this failed. This could be the reason.
Nevertheless, going with a single style will improve readability and
minimize errors. I guess I will update the code conventions later on if
no one contradicts.
Cheers
Christoph
Marc Jansen schrieb:
Hey Christoph,
this example works like a charm:
var c = {}; // object
var d = {}; // object
c.test = "testvalue"; // dot on object
d["test"] = "testvalue"; // parens on object
alert( c.toJSONString() ); // alerts: {"test" : "testvalue"}
alert( c.toJSONString() === '{"test":"testvalue"}' ); // alerts:
true
alert( d.toJSONString() ); // alerts: {"test" : "testvalue"}
alert( d.toJSONString() === '{"test":"testvalue"}' ); // alerts:
true
alert( c.toJSONString() === d.toJSONString() ); // alerts: true
Can you post a minimal example that fails? Maybe it isn't the
toJSONString()-method that is the root of this error.
-- Marc
Mapbender schrieb:
#120: replace ["..."] with dot notation in JS
--------------------------+-------------------------------------------------
Reporter: christoph | Owner: mapbender_dev@lists.osgeo.org
Type: refactoring | Status:
new Priority: major |
Milestone: 2.5 release Component: core
| Version:
Resolution: |
Keywords:
--------------------------+-------------------------------------------------
Comment (by christoph):
1. correct. I tried converting the map object to JSON via
toJSONString(),
and the entries for the arrays created with the bracket syntax were
omitted. I had to use the dot syntax. Now I realize why JSLint always
complains about the bracket syntax.
2. I mean the anyObject.toJSONString from json.js, which itself is from
www.json.org
------------------------------------------------------------------------
_______________________________________________
Mapbender_dev mailing list
Mapbender_dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapbender_dev
_______________________________________________
Mapbender_dev mailing list
Mapbender_dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapbender_dev
--
***************************************
Where2B-Konferenz
Die Lösungskonferenz der WhereGroup
am 29. November 2007 in Bonn
http://www.where2b-conference.com
***************************************
_______________________________________
W h e r e G r o u p GmbH & Co. KG
Siemensstraße 8
53121 Bonn
Germany
Christoph Baudson
Anwendungsentwickler
Fon: +49 (0)228 / 90 90 38 - 17
Fax: +49 (0)228 / 90 90 38 - 11
[EMAIL PROTECTED]
http://www.wheregroup.com
Amtsgericht Bonn, HRA 6788
_______________________________________
Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Arnulf Christl, Olaf Knopp, Peter Stamm
_______________________________________
_______________________________________________
Mapbender_dev mailing list
Mapbender_dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapbender_dev