PDA

View Full Version : Sencha Architect 2.1.0 b588 prevents me from using "reserved keywords" as field names



apsq
24 Aug 2012, 8:11 AM
Maybe this is some kind of limitation with ExtJS, but there's literally nothing wrong with using words like "delete" as object property names in JavaScript, let alone as string values.

Currently this limitation can be circumvented by editing the metadata file directly, but it's a definite smell that either SA2/ExtJS is doing something silly internally or that SA2 is enforcing unnecessary restrictions.

So what's the story behind this? I understand that there are internal limitations preventing users from overriding certain properties of ExtJS components, but this is just plain weird.

aconran
31 Aug 2012, 10:22 AM
In general using reserved keywords for keys I would say is bad practice. We are preventing that at the moment. In the event that a user uses a keyword we would have to quote it.

We may implement this down the road.

apsq
31 Aug 2012, 12:57 PM
The value is quoted anyway. This means the issue can be worked around by editing the metadata files directly. At no point down the line is the value used without quotes.

As field names are used in Ajax requests primarily and JSON does not have the concept of reserved keywords as it is a language independent format, I would argue that in this case using JavaScript's reserved keywords is perfectly legitimate.

I would agree if ExtJS provided any abstraction when it comes to models and server-side data formats. The convert functions are okay, but I can't find any way to provide model-wide conversions (i.e. a function that takes raw service data as input, modifies the current model instance and is called transparently; plus a second function that does the inverse for write operations).