Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-5103 in a recent build.
  1. #1
    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 [4.1b1] Bug with Implicit Model / Store / MixedCollection / Proxy

    [4.1b1] Bug with Implicit Model / Store / MixedCollection / Proxy


    REQUIRED INFORMATIONExt version tested:
    • Ext 4.1 rev B1
    • Ext 4.0.7
    Browser versions tested against:
    • Chrome 16
    DOCTYPE tested against:
    • Transitional
    Description:
    • In 1 store the getKey function applied to the data's MixedCollection object is returning an id of 1 no matter what the actual id is. This in turn is causing MixedCollection's add method to overwrite the models and the result is only the last model is added to the data collection.
    • During the loop in addAll in the AbstractMixedCollection class it calls add, in the 'add' method I put the following console.log in
      Code:
      if (arguments.length == 1) {            myObj = myKey;
          console.log('myKey', myObj, myObj.id, myObj.internalId, me.getKey(myObj));
          myKey = me.getKey(myObj);
      }
    • See the screen shots and output below for the results.
    • As a side note replacing 4.1 with 4.0.7 fixes this issue. So it's a change that happened sometime between 4.0.7 and 4.1
    Steps to reproduce the problem:
    • Unsure...
    The result that was expected:
    • the getKey method of MixedCollection returns the appropriate id.
    The result that occurs instead:
    • the getKey method always returns 1
    Test Case:

    Working Store.
    Code:
      
    // Store definition
    Ext.define('Foo.store.user.UserStore', {
        extend:'Ext.data.Store',
        autoLoad:false,
        fields:[
            {name:'userId', type:'int'},
            {name:'firstName', type:'string'},
            {name:'lastName', type:'string'},
            {name:'username', type:'string'},
            {name:'disabled', type:'bool'}
        ],
        proxy:{
            type:'direct',
            reader:{
                idProperty:'userId',
                type:'json',
                root:'data'
            },
            api:{
                read:Foo.Direct.User.readUsers
            }
        }
    });
    Broken Store.

    Code:
    Ext.define('Foo.store.project.ProjectStore', {
        extend:'Ext.data.Store',
        autoLoad:false,
        fields:[
            {name:'projectId', type:'int'},
            {name:'name', type:'string'},
            {name:'subscriptionType', type:'string'},
            {name:'projectStatus', type:'string'}
        ],
        proxy:{
            type:'direct',
            reader:{
                idProperty:'projectId',
                type:'json',
                root:'data'
            },
            api:{
                read:Foo.Direct.Project.readProjects
            }
        }
    });
    Data returned by server
    Code:
    //Project
    [
      {"projectId":5,"name":"Fallout Town","subscriptionType":"","projectStatus":"Closed"},
      {"projectId":1,"name":"Science Lab","subscriptionType":"","projectStatus":"Active"},
      {"projectId":2,"name":"Underground City","subscriptionType":"Professional Unlimited","projectStatus":"Active"}
    ]
    
    
    //User
    [
      {"userId":1,"firstName":"Admin","lastName":"Lasso","username":"devteam","disabled":0},
      {"userId":2,"firstName":"Alice","lastName":"T-Virus","username":"alice","disabled":1},
      {"userId":3,"firstName":"Jill","lastName":"Valentine","username":"jillv","disabled":0},
      {"userId":4,"firstName":"yetestse","lastName":"testestes","username":"testestse","disabled":0}
    ]

    Possible fix:
    • ????
    Additional CSS used:
    • only default ext-all.css
    Operating System:
    • Windows 7
    Attached Images

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,731
    Vote Rating
    754
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    We will take a look at it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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

      0  

    Default


    I cannot reproduce this with latest code, so I'm wondering if it has been found by internal testing and fixed already.

    I have the following JS code:

    Code:
    Ext.require('*');
    Ext.onReady(function() {
    
        Ext.define('UserStore', {
            extend: 'Ext.data.Store',
            fields:[
                {name:'userId', type:'int'},
                {name:'firstName', type:'string'},
                {name:'lastName', type:'string'},
                {name:'username', type:'string'},
                {name:'disabled', type:'bool'}
            ],
            proxy:{
                type: 'ajax',
                url: '5103Users.json',
                reader: {
                    idProperty: 'userId',
                    type: 'json',
                    root:'data'
                }
            },
            listeners: {
                refresh: function(s) {
                    console.log('User internalIds:');
                    s.each(function(r) {
                        console.log(r.internalId);
                    });
                }
            }
        });
        new UserStore({
            autoLoad: true
        });
    
        Ext.define('ProjectStore', {
            extend: 'Ext.data.Store',
            fields: [
                {name:'projectId', type:'int'},
                {name:'name', type:'string'},
                {name:'subscriptionType', type:'string'},
                {name:'projectStatus', type:'string'}
            ],
            proxy: {
                type: 'ajax',
                url: '5103Projects.json',
                reader: {
                    idProperty: 'projectId',
                    type: 'json',
                    root: 'data'
                }
            },
            listeners: {
                refresh: function(s) {
                    console.log('Project internalIds:');
                    s.each(function(r) {
                        console.log(r.internalId);
                    });
                }
            }
        });
        new ProjectStore({
            autoLoad: true
        });
    });
    And in 5103Projects.json I have

    Code:
    {
        data: [
            {"projectId":'Project1',"name":"Science Lab","subscriptionType":"","projectStatus":"Active"},
            {"projectId":'Project2',"name":"Underground City","subscriptionType":"Professional Unlimited","projectStatus":"Active"},
            {"projectId":'Project5',"name":"Fallout Town","subscriptionType":"","projectStatus":"Closed"}
        ]
    }
    and in 5103Users.json I have

    Code:
    {
        data: [
          {"userId":'User1',"firstName":"Admin","lastName":"Lasso","username":"devteam","disabled":0},
          {"userId":'User2',"firstName":"Alice","lastName":"T-Virus","username":"alice","disabled":1},
          {"userId":'User3',"firstName":"Jill","lastName":"Valentine","username":"jillv","disabled":0},
          {"userId":'User4',"firstName":"yetestse","lastName":"testestes","username":"testestse","disabled":0}
        ]
    }
    When I run the testcase I see

    Code:
    XHR finished loading: "http://localhost/Sencha/SDK/extjs/test/issues/5103Users.json?_dc=1326712929659&page=1&start=0&limit=25".
    User internalIds:
    User1
    User2
    User3
    User4
    XHR finished loading: "http://localhost/Sencha/SDK/extjs/test/issues/5103Projects.json?_dc=1326712929662&page=1&start=0&limit=25".
    Project internalIds:
    Project1
    Project2
    Project5
    Which is what I expected.

    What happens if you run the above code with the above 2 files in the same directory?

  4. #4
    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 works for me as well, I couldn't reproduce it in proper test case either which is why I didn't include one. It seems to be some sort of race condition... The actual application that these stores are in it quite significant in size.
    I'm wondering if somewhere down the line some references to objects are being munged up.
    Out of the 70+ stores we currently have and the 50+ screens this is the only occurrence of it I have found, Like I said simply dropping in 4.07 instead of 4.1 fixes this issue. I have spent a couple days now narrowing it down to that area of the code, however the definition and implementation of that store is so simple I cannot for the life of me figure out why its not working. If you want I can provide you access to my development box to have a closer look... Or perhaps you can suggest something else I can try?

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

      0  

    Default


    Try adding this to your overrides

    Code:
    Ext.override(Ext.data.Reader, {
    
        buildExtractors: function(force) {
            var me          = this,
                idProp      = me.getIdProperty(),
                totalProp   = me.totalProperty,
                successProp = me.successProperty,
                messageProp = me.messageProperty,
                idField,
                map;
                
            if (force === true) {
                delete me.convertRecordData;
            }
            
            if (me.convertRecordData) {
                return;
            }   
    
            //build the extractors for all the meta data
            if (totalProp) {
                me.getTotal = me.createAccessor(totalProp);
            }
    
            if (successProp) {
                me.getSuccess = me.createAccessor(successProp);
            }
    
            if (messageProp) {
                me.getMessage = me.createAccessor(messageProp);
            }
    
            if (idProp) {
                idField = me.model.prototype.fields.get(idProp);
                if (idField) {
                    map = idField.mapping;
                    idProp = (map !== undefined && map !== null) ? map : idProp;
                }
    
                me.getId = function(idAccessor) {
                    return function(record) {
                        var id = idAccessor(record);
                        return (id === undefined || id === '') ? null : id;
                    };
                }(me.createAccessor(idProp));
            } else {
                me.getId = function() {
                    return null;
                };
            }
            me.convertRecordData = me.buildRecordDataExtractor();
        }
    });

  6. #6
    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


    Adding that override gives me the following error

    Uncaught TypeError: Object [object Object] has no method 'buildRecordDataExtractor'

    In Regards to the following line.
    Code:
    me.convertRecordData = me.buildRecordDataExtractor();



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

      0  

    Default


    Ach!

    New cool new feature, in 4.1.0 beta 2 in which all data fields are extracted in one method call, not a separate, generated method for each field..

    Hang on, I'll try to post an override for 4.1. beta 1

  8. #8
    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


    Is beta 2 available to me

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

      0  

    Default


    Code:
    Ext.override(Ext.data.Reader, {
    buildExtractors: function(force) {
            var me          = this,
                idProp      = me.getIdProperty(),
                totalProp   = me.totalProperty,
                successProp = me.successProperty,
                messageProp = me.messageProperty,
                accessor,
                idField,
                map;
                
            if (force === true) {
                delete me.extractorFunctions;
            }
            
            if (me.extractorFunctions) {
                return;
            }   
    
            //build the extractors for all the meta data
            if (totalProp) {
                me.getTotal = me.createAccessor(totalProp);
            }
    
            if (successProp) {
                me.getSuccess = me.createAccessor(successProp);
            }
    
            if (messageProp) {
                me.getMessage = me.createAccessor(messageProp);
            }
    
            if (idProp) {
                idField = me.model.prototype.fields.get(idProp);
                if (idField) {
                    map = idField.mapping;
                    idProp = (map !== undefined && map !== null) ? map : idProp;
                }
                accessor = me.createAccessor(idProp);
    
                me.getId = function(idAccessor) {
                    return function(record) {
                        var id = idAccessor(record);
                        return (id === undefined || id === '') ? null : id;
                    };
                }(me.createAccessor(idProp));
            } else {
                me.getId = function() {
                    return null;
                };
            }
            me.buildFieldExtractors();
        }
    });
    Still the call to build all the separate field extractor methods needed there at the bottom!

  10. #10
    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


    Unfortunately I get the same result. I forgot to mention that the 3 records do exist in the proxies rawData property as well as the grids row numberer is acknowledging there are 3 records because the row that is displayed shows a value of 3. Its just that the getKey method returns the same id every time which clobbers all the previous records.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar