PDA

View Full Version : Object config definitions are converted to strings.



badgerb1
23 Feb 2012, 12:08 PM
Hi Guys,

I'm sure you have seen this already and are working on it but just in case.

If I want to add a new config property, I cannot define it as an object or a function call. The property automatically converts it to a string.

To reproduce.
Set up a component of any kind.
Add a new propery maybe call it foo.
Add an object definition be the value of the property.
Expected the code to be
foo:{a:1}
actual code output is
foo:'{a:1}'

Also, wouldn't be able to set a function call, like Ext.create('FooObject').


Thanks
Bob

badgerb1
23 Feb 2012, 12:41 PM
Cool, just found an answer for this, would be nice if it was more intuitive/explicit.

Basically if you want to add a custom property of other than string you have to put at least a base definition in the search/add box. I.E.

If you want to add foo as an object, instead of just putting foo in the property search/add box and hitting add, you have to put foo : {} at least (you probably could put the entire object there but it's not easy to type that much in the search box).

Arrays can be added with [] (although when I tried it looked like it locked up and I had to clear the search box manually.
so
foo : []

function definitions can be added with
foo : function(a, b) {}

However,
foo: Ext.create('FooObject')
still doesn't appear to work.

Thanks
Bob

aconran
23 Feb 2012, 1:23 PM
Objects, arrays, functions, strings, numbers and booleans are supported.

Eg
foo: {}, [], function() {}, 'string', 123, true

Frith
7 Aug 2013, 4:44 AM
Any update on this?

I'm trying to add 'plugins' with a value of Ext.create('Ext.yadda') but Architect keeps converting it to a string.