PDA

View Full Version : MixedCollection Issue



taxidriver
2 Dec 2010, 12:36 AM
I have an Ext.util.MixedCollection myCollection which holds some string-object items.
After applying the method myCollection.get("someKey") it returns null.
However, after applying the method myCollection.key("someKey") it returns the desired value!!!
According to API http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.MixedCollection both methods should return the same.
Is there a bug or get method has some limits?

devtig
2 Dec 2010, 3:29 AM
Could you show the code that creates the MixedCollection?

taxidriver
2 Dec 2010, 4:31 AM
After reading more carefully the API I've found that for get method exists that :
If the item is found, returns the item. If the item was not found, returns <tt>undefined</tt>. If an item was found, but is a Class, returns <tt>null</tt>.
My objects in the MixedCollection were Classes, so it is normal to return null, according to API.
So, is it safer to use key for general circumstances and when somebody should use the get method?