dimanche 15 mars 2015

ExtJS 5 - How to convert Object to Collection/MixedCollection/HashMap?


Vote count:

0




I have an object on which i would like to perform add/remove/find operation. So i'm just trying to convert that Object as HashMap/Collection object using Ext.util.Collection/Ext.util.MixedCollection/Ext.util.HashMap classes. As it is already an Object i just want to perform typecasting? Is there a straight forward option availble in ExtJS to attain this?


Currently using the following utility method i'm attaining this. Is there any other better option available other than this?


Raw Object:-



Object {abbreviateValues: true, category: "P", charCode: 13092,charDescription: Array[5], charId: 13092…}


Utility Method:-



convertObjectToCollection: function(rawObject){
var hashMapObject = Ext.create('Ext.util.HashMap');
for(var key in rawObject) {
hashMapObject.add(key,rawObject[key]);
}
return hashMapObject;
}


Thanks!



asked 56 secs ago







ExtJS 5 - How to convert Object to Collection/MixedCollection/HashMap?

Aucun commentaire:

Enregistrer un commentaire