-
11 Feb 2012 1:44 PM #1
How to define an object in Component Config
How to define an object in Component Config
I'm currently using an Ext.Map view, but this applies to any view really. In the component config area for Ext.Map there is a mapOptions setting. The text for the value shows [object]..., when I click on it I get a blank box. I try to add my object in there and it sets my value as a quoted string in code view.
What I put in:
{ centered: 45.622469,-122.666933 }
What I expect to show up in code view:
But here is what I actually get:Code:... config: { mapOptions: { centered: 45.622469,-122.666933 } } ...
How can I set the value for mapOptions (or any object in the component config area) and have it take it as an object instead of a literal string?Code:... config: { mapOptions: '{ centered: 45.622469,-122.666933 }\n' } ...
Thanks!
-JoeLast edited by joe_montanab; 11 Feb 2012 at 1:45 PM. Reason: comment for second code block
-
11 Feb 2012 7:25 PM #2
Thats not a valid object
needs to be { prop: value, prop1: value}
Look at this
http://code.google.com/apis/maps/doc...tml#MapOptions
This is one way to specify an object but the center expects a reference and we dont support reference in Designer currently so you will need to add custom code in impl class.
{
center:new google.maps.LatLng(-34.397,150.644),
zoom:8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}Bharat Nagwani
Sencha Designer Development Team
-
14 Feb 2012 12:10 PM #3
-
14 Feb 2012 12:25 PM #4
I did- the problem was that I had a syntax error in my object definition. I figured out that if there is an object value and you actually type in a proper object it works fine and auto-generates the object in your code, but if you make a syntax error it turns it into a string instead.
So, flip to code view and make sure you didn't mess up the syntax anywhere, you'll see it create an object or string based on what you type in.
-
14 Feb 2012 1:01 PM #5
Ahh, I see. Thanks! For some reason it doesn't like mapTypeId though. The other mapOptions seem to work as you described.


Reply With Quote