PDA

View Full Version : Contrary to doc for class system, cannot define simple getter for class item.



bimargulies
14 Aug 2012, 5:57 PM
In my class, I have:



config: { serverResponse: ''},
getServerResponse: function() {
return this.getServerResponse();
},
setServerResponse: function(val) {
...
}


My set function works just fine. My get function is displaced by a complex, auto-generated get function that calls my set function, amongst other things.

What am I missing?

vietits
14 Aug 2012, 7:04 PM
With Ext 4 Class System, getter and setter methods for every config property are automatically generated into the class' prototype during class creation if the class does not have these methods already defined. So, you should not defined these getter and setter by yourself.

See more information at Class System > III. Hands-on > 2. Configuration (http://docs.sencha.com/ext-js/4-1/#!/guide/class_system)

bimargulies
15 Aug 2012, 5:27 AM
I read the very documentation you have quoted for me. In particular, I read, " if the class does not have these methods already defined."

If the definition of the product is that I am not permitted to define these methods for myself, then this statement that we both quoted is somewhere between misleading and flat out wrong. If this statement is not wrong, then your subsequent remark must require some additional nuance.