Results 1 to 3 of 3

Thread: Model.replaceFields does not update fieldsMap of prototype correctly

    You found a bug! We've classified it as EXTJS-19983 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member
    Join Date
    Jun 2009
    Posts
    63

    Default Model.replaceFields does not update fieldsMap of prototype correctly

    Fiddle:

    https://fiddle.sencha.com/#fiddle/11ia

    Ext version tested:

    • 5.1.1.451
    • 5.1.2.748
    • 5.1.3.228

    Browser versions tested against:
    • Chrome
    • Firefox
    • IE8
    • IE9

    Description:
    • Calling Model.replaceFields() does not update the fieldsMap of the Model's prototype.

    Steps to reproduce the problem:
    • Call Model.replaceFields
    • Access the prototype fieldsMap

    The result that was expected:

    • fieldsMap holds same fields as Model does

    The result that occurs instead:
    • fieldsMap holds old fields


    Fix:
    Code:
    Ext.define('Perbility.fix.data.Model', {
        override: 'Ext.data.Model',
        
        statics: {
            replaceFields: function(newFields, removeFields) {
                var Self = this;
                
                Self.callParent(arguments);
                
                if (removeFields === true) {
                    // Update fields map on proptotype
                    Self.prototype.fieldsMap = Self.fieldsMap;
                }
            }
        }
    });

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report and override! I have opened a bug in our bug tracker.

  3. #3
    Ext JS Premium Member
    Join Date
    Jun 2009
    Posts
    63

    Default

    C'mon guys. This bug is easy to fix, why did my unit test just tell me that it still exists in ExtJs 5.1.3?

Similar Threads

  1. Model.replaceFields removes the Id Field
    By FBNitro in forum Ext JS 6.x Bugs
    Replies: 3
    Last Post: 19 Sep 2015, 11:52 PM
  2. Model.replaceFields reads idProperty from wrong object
    By themightychris in forum Ext JS 6.x Bugs
    Replies: 3
    Last Post: 1 Aug 2015, 11:11 AM
  3. Replies: 4
    Last Post: 14 Apr 2015, 9:19 PM
  4. what is the EXTJS equivalent of Prototype $(ID).update?
    By dduffy in forum Sencha Ext JS Q&A
    Replies: 1
    Last Post: 13 Sep 2010, 12:18 PM
  5. UpdateManager.prototype.update()
    By Animal in forum Community Discussion
    Replies: 6
    Last Post: 1 Nov 2006, 4:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •