Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJS-5217
in
a recent build.
-
[4.1-20120123] Unable to use 'class' model fields
It's pretty understandable that the word class is a reserved word in JavaScript and so it's not a good idea to use that word as a name of variable. As for keys/identifiers (such as model/record field names), it has never been a problem. Until ExtJS 4.1.
So, the following code
Code:
Ext.define('Foo', {
extend: 'Ext.data.Model',
fields: ['class']
});
generates a "class is a reserved identifier" error on Firefox 9.0.1):
class-ext4.1.png
For some reason, field identifiers get evaluated to variables.
So, the question is: do I have to go through my code and replace all "class" fields with "cls", or is this behaviour unintentional and will be fixed?
-
This was an unintentional regression, it will be fixed in B3.
To fix it, in Reader.js:
Code:
// current
fieldVarName[i] = Ext.String.createVarName(field.name);
// fix
fieldVarName[i] = '_' + Ext.String.createVarName(field.name);
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
-
-
DELACAP |
Github
"don't code today what you can't debug tomorrow"
-
Just for the sake of completeness, there are 3 types that will fail at the moment:
1) Reserved words
2) Names that conflict with the local vars in the function
3) Names that start with numbers
A fix that addresses these cases has been pushed up to the main repo and is awaiting a merge.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
-
Sencha User
It seems that you can add one more illegal word for field names: "source"
-
Ext JS Premium Member
Evan,
Can you set our expectations for when we should see these fixes in the 4.1 nightly builds? I'm not seeing any changes in Reader.js. Why does it take any longer than the following nightly build?
Thanks..
-
Long story very short, we've got a bunch of stuff that needs to be merged into the main repo but we've got a bit of a backlog. Hopefully it should be sorted out within the next few days.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
-
Sencha User
Stuck with the same problem
Hi Evan ,
is it possible to access the nightly build?
I am stuck with the same problem.
Thank you
-
Sencha User
Was this fixed in beta 3?
Hi Receive the same error even if i installed beta 3
was this fixed?