Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-5103 in a recent build.
  1. #11
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    They getKey of the MixedCollection is just an injected function which returns this.internalId

    So the key is how the internalId of the Record is set.

    Look for this code in the reader:"

    Code:
        extractData : function(root) {
            var me = this,
                records = [],
                Model   = me.model,
                length  = root.length,
                clientIdProp = Model.prototype.clientIdProperty,
                fields = me.getFields(),
                fieldLength = fields.length,
                convertedValue, convertedValues, field, name, node, id, record, i, j, value;
                
            if (!root.length && Ext.isObject(root)) {
                root = [root];
                length = 1;
            }
    
            for (i = 0; i < length; i++) {
                node = root[i];
                id = me.getId(node);
                // Create a record with an empty data object.
                // Populate that data object by extracting and converting field values from raw data
                record = new Model(undefined, id, node, convertedValues = {});
    And see if you can step into there in the Readers you are testing.

  2. #12
    Ext JS Premium Member zodeus's Avatar
    Join Date
    Jan 2010
    Location
    Vancouver Canada
    Posts
    36
    Vote Rating
    0
    zodeus is on a distinguished road

      0  

    Default


    The line in the extractData method of Ext.data.reader.Reader

    id = me.getId(node);

    is in fact returning the correct numbers, in my case (1,2,5) so the problem must be occurring higher up the tree, I will being going up the stack and try and locate it.

  3. #13
    Ext JS Premium Member zodeus's Avatar
    Join Date
    Jan 2010
    Location
    Vancouver Canada
    Posts
    36
    Vote Rating
    0
    zodeus is on a distinguished road

      0  

    Default


    Ok I'v located the problem code, however I have no idea what it's purpose is.

    I forgot to include the a portion of the data being returned.... sorry about that.

    Inside of the Readers extractData method there is this code

    Code:
    if (node[clientIdProp]) {
         record.internalId = node[clientIdProp];
    }
    My data set returned has 2 ids, a projectId and a clientId (1 client many projects). initially the internalId is set correctly based on the idProperty value however once it passes over that code, it sees that there is also a 'clientId'?? property on the node and then updates it to that... Which happens to be the same for each of my models being returned because I'm returning a list of data associated with a client...

    Removing that property from the json data being returned fixes the issue.

  4. #14
    Ext JS Premium Member zodeus's Avatar
    Join Date
    Jan 2010
    Location
    Vancouver Canada
    Posts
    36
    Vote Rating
    0
    zodeus is on a distinguished road

      0  

    Default


    It seems like this property is used internally to track batch changes in the writer. However this seems like a fairly common field name, is there any chance you can rename it to something a little more obscure?

  5. #15
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    That would be a good idea. I have transferred this ticket to the engineer who implemented the clientId property. We will come up with a fix for 4.1.0 final.

  6. #16
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    905
    Vote Rating
    40
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Ah, excellent!
    Skirtle sent me here for a look... glad to see it's being picked up!

    I hit the issue and reported it in the beta forum, but didn't get much traction...

    For what it's worth, my base model sets the clientIdProperty to 'phantomId', since I believe that's what it's intended for?

    Cheers,
    Westy
    Product Architect
    Altus Ltd.

  7. #17
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,346
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    This is fixed post-RC1 (just now merged). The clientIdProperty will default to null.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"