Threaded View
-
12 Jan 2012 4:35 PM #1
[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
- Chrome 16
- Transitional
- 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
- Unsure...
- the getKey method of MixedCollection returns the appropriate id.
- the getKey method always returns 1
Working Store.
Broken 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 } } });
Data returned by serverCode: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 } } });
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:- ????
- only default ext-all.css
- Windows 7
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-5103
in
4.1.


Reply With Quote