PDA

View Full Version : setting properties to objects.



cantorh
6 Feb 2012, 8:48 AM
Hello,
Is there a way to set string type properties to string objects? For example… a proxy has a url property. Let’s say I have a string object with the url. How can I set the url property to the string object? When I try to do so Designer sets the url property to a string literal of the name of the object.

-thanks,
Hugo.

bharatn
6 Feb 2012, 9:32 AM
url is a string
http://docs.sencha.com/touch/2-0/#!/api/Ext.data.proxy.Server-cfg-url

Does that answer your query? Please give an example what you are trying to do.
Thanks

cantorh
6 Feb 2012, 10:26 AM
Hello Bharatn,
Using the url property as an example, let's say I have a string object called staticUrl in MyApp namespace...

MyApp.staticUrl = '/someBackEndScript';

I'd like to set up the url property as such...
proxy: {
type: 'ajax',
url: MyApp.staticUrl, // Setting url to the value of object MyApp.staticUrl. This is what I'd like to do.
reader: {
type: 'json'
}
}


However, Designer sets the url property to the name of the object as such...
proxy: {
type: 'ajax',
url: 'MyApp.StaticUrl', //Setting url name of the object
reader: {
type: 'json'
}
}

-thanks,
Hugo.

aconran
6 Feb 2012, 11:26 AM
Hugo -

There is currently no way to use variables in these properties.

fortec56
27 Aug 2012, 9:37 AM
aconran (http://www.sencha.com/forum/member.php?802-aconran)

Is there any way to achieve what cantorh (http://www.sencha.com/forum/member.php?115900-cantorh) is trying to do?, Maybe override some attribute or function somewhere to get this kind of functionallity.
Due the application isn't very portable in the other way.
Thanks in advance.

aconran
27 Aug 2012, 9:55 AM
Yes you can use overrides and/or set a variable in an event handler.