-
12 Dec 2012 11:23 AM #1
XTemplate can't access the attribute with "is" style getter method
XTemplate can't access the attribute with "is" style getter method
Required Information
Version(s) of Ext GWT
«Ext GWT 3.0.1»
Browser versions and OS
(and desktop environment, if applicable)- Chrome 24, Windows XP
No
Description
"com.sencha.gxt.core.rebind.Context" only check the "get" method, regardless of the "is" method, cause boolean attributes of my model class cannot be detected and bound to a context. Please see com.sencha.gxt.core.rebind.Context line 70(v3.0.1).
Run mode
development mode
Steps to reproduce the problem- model class "User" has a boolean attribute named "allowed", and the getter named "isAllowed()".
- XTemplate(...<b>{allowed}</b>...) render a user object.
- treelogger report a error:Reference could not be found: 'allowed'. Please fix the expression in your template.
- debug code,Context.knownValues have no "allowed" attribute.
Attributes of Java Bean class can be access in XTemplate.
Actual result
The attribute with "is" style getter method can't be access in XTemplate
Test case
Code:public class User implements Serializable{ private boolean allowed; public boolean isAllowed(){ return allowed; } public void setAllowed(boolean allowed){ this.allowed = allowed; } } interface UserTemplate extends XTemplates { @XTemplate(source = "template.html") SafeHtml draw(User user); } template.html <b>{allowed}</b> User user = new User(); user.setAllowed(true); SafeHtml html = ((UserTemplate)GWT.create(UserTemplate.class)).draw(user);
-
12 Dec 2012 11:50 AM #2
Please stop reposting this - as a relatively new user, it was caught in the spam filter, and I've approved it and deleted your other two messages.
-
12 Dec 2012 11:53 AM #3
This was reported in http://www.sencha.com/forum/showthread.php?240556 and fixed in 3.0.2.
As noted in that bug, there is a workaround - refer to {user.allowed} instead of just {allowed}.
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote