-
25 Jan 2012 1:04 AM #1
[4.1-20120123] Unable to use 'class' model fields
[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
generates a "class is a reserved identifier" error on Firefox 9.0.1):Code:Ext.define('Foo', { extend: 'Ext.data.Model', fields: ['class'] });
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?
-
26 Jan 2012 3:53 PM #2
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);
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
27 Jan 2012 10:21 AM #3
Just want to link back to http://www.sencha.com/forum/showthre...031#post722031.
It's a bit different. In this case the field name is a reserved word in javascript, in the other case the field name matches a local parameter.
As you said in the other thread, the same fix will likely take care of both but a linkback is a good idea so we make sure
.
James
-
27 Jan 2012 10:43 AM #4
-
27 Jan 2012 4:07 PM #5
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.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
28 Jan 2012 5:02 PM #6
It seems that you can add one more illegal word for field names: "source"
-
31 Jan 2012 10:06 AM #7
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..
-
31 Jan 2012 9:59 PM #8
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.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
22 Feb 2012 5:26 AM #9
Stuck with the same problem
Stuck with the same problem
Hi Evan ,
is it possible to access the nightly build?
I am stuck with the same problem.
Thank you
-
1 Mar 2012 7:03 AM #10
Was this fixed in beta 3?
Was this fixed in beta 3?
Hi Receive the same error even if i installed beta 3
was this fixed?
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-5217
in
TBD.


Reply With Quote