PDA

View Full Version : How to scape + caracter on propertie that expect string



wemerson.januario
27 Jul 2010, 5:31 PM
How can i insert a var into To properties that expect an object or array?
ex in my store, I defined a global var called myPrefixVar and I need to use it url propertie:
The problem is that it doesn't scape the + caracter
url: myPrefixVar+"/mydir/anotherDir/save"

jarrednicholls
29 Jul 2010, 4:53 AM
Not sure I understand your question exactly. What do you mean it doesn't "scape" the character? Do you mean "escape"? Are you trying to set this in the Designer or in an implementation file? You cannot use arbitrary variable names in the Designer, it has to be a pure string. Can you clarify the context? Based on what I currently know, I would suggest this dynamic URL be setup when you create the instance of your Store (if it's a store of course):



var store = MyStore({
url: myPrefixVar + '/mydir/anothrDir/save'
});

wemerson.januario
29 Jul 2010, 9:37 AM
Not sure I understand your question exactly. What do you mean it doesn't "scape" the character? Do you mean "escape"? Are you trying to set this in the Designer or in an implementation file? You cannot use arbitrary variable names in the Designer, it has to be a pure string. Can you clarify the context? Based on what I currently know, I would suggest this dynamic URL be setup when you create the instance of your Store (if it's a store of course):



var store = MyStore({
url: myPrefixVar + '/mydir/anothrDir/save'
});


Not scape. i need to set arbitrary name in designer, not pure string. I'm trying to set it on Ext Designer.
I use the Store api, so I have a global var named myPrefixVar, then I need to use the myPrefixVar var, because almost all stores use this prefix var.
Thanks.
Is it possible to use into designer ?

jarrednicholls
29 Jul 2010, 8:34 PM
Hi Wemerson,

As I previously stated, you cannot use a variable name in any string config, it has to be an inline string. For your case, you should configure the store's url at instantiation time using the variable since it is dynamic. That would be a best practice anyways (code separation).

Thanks.