PDA

View Full Version : [CLOSED] Configuration Objects Converted to String



nickelstar5
16 Aug 2012, 6:16 AM
When adding configuration objects like Ext.window.Window.loader, the object is converted to a string. I was expecting it to be left as an object. In any case, the configuration does not work... either is ignored upon load or creates errors.

aconran
16 Aug 2012, 7:48 AM
If there is a syntax error in your object definition, we will do this to protect you. We need to add in some better warning message to notify users what is going on.

Are there any extra commas and/or variables/function calls that Architect cannot resolve?

nickelstar5
16 Aug 2012, 9:34 AM
I don't think it's a formatting issue. To show a simplified example, I've attached 2 screenshots showing a loader config object that gets converted to a string. I should note that I tried wrapping the object in curly brackets as well but that too was converted. The pic on the left is the class definition with the object converted to a string. The right one is the editor for the config object.

3801338014

nickelstar5
16 Aug 2012, 11:46 AM
It looks like the object's property names must be wrapped in quotes. That's okay but isn't the way Architect or myself write them in our own code. Easy enough to do now that I've figured that out. However, there's still a problem if you want to assign a variable to a property like this:

{'productNumber': myProductNumberVar }

This gets converted to string even though it's a valid Javascript object.

aconran
16 Aug 2012, 12:27 PM
That's correct. It does not support variables/functions/JS expressions at this time.

nickelstar5
16 Aug 2012, 12:52 PM
Fair enough. Also, I did find at least one object editor that accepts property names without quotes: the 'editor' parameter on Grid columns. So it looks like the object editors are applying inconsistent formatting rules. Not a big deal but something to be aware of.

aconran
16 Aug 2012, 12:55 PM
Quoted on the lefthand side is not a requirement unless its something like "320x460"

smcguire36
13 Nov 2012, 12:48 PM
Definitely need to have a warning message letting the user know about these restrictions when it converts it to a string with perhaps an option to disable the warning. This took my colleague and I several hours of trial and error and then searching here to figure out why our JSON object was always converted to a string. Also, definitely need the ability to handle varialbles, functions and JS expressions.

aconran
13 Nov 2012, 1:32 PM
Look for coming improvements in Architect 2.2.

smcguire36
13 Nov 2012, 1:59 PM
Sweet! :)