View Full Version : Model.replaceFields removes the Id Field

17 Jul 2015, 7:29 AM
Ext version tested:

Ext 6.0.0

Browser versions tested against:



Model.replaceFields(fields, true) removes the ID column

Steps to reproduce the problem:

Fiddle below

The result that was expected:

Since the original fields list did not specifically include the IdProperty field (it was defaulted to id by the model definition because I didn't set one), I do not expect it to be removed when replaceFields was called.

The result that occurs instead:



17 Jul 2015, 5:02 PM
Out of interest, why change the fields of an existing model? Why not just declare a new one?

20 Jul 2015, 6:53 AM
Our model field list is configurable by the end customer, so each server has a unique configuration.

As part of the sign-in sequence, we define the models.

As of Ext6, I haven't found a way to redefine the models yet. In touch, I could do a ext.define('model1', {blah...}) and then at re-sign in, do a ext.define('model1', {blah}) if they switched servers etc and touch would just replace the old model with the new one.

In Ext6, so far, when I try to do this I get an exception saying the model is already defined (I don't recall the exact error, but that's the gist of it). So, I now check is the model is defined, and if so replace the fields...

Dejan Beciric
19 Sep 2015, 11:52 PM
Also, if you try to remove fields from existing model with removeFields(true), applicatin will throw exception in:idField.allowNull = idField.critical = idField.identifier = true;

@evant - I have the same problems as FBNitro, with model fields that needs to be dynamically changable