extjs - How to convert array of object to array of model object -


i have model defined bus having fields tyre (string), color(string) , company(string).in main panel trying read data 1 ajax , other webservice call.both of needs displayed on same grid.

in store creating array of records has 2 arrays 1 prepared ajax call , other prepared webservice data.i call method , data webservice , push main records array have data type of object stores different.

when checked using chrome dev tools seems me 1 prepared ajax equivalent model , other 1 object having fields.the below have model:function points model defined.

data:object > have values webservice array object. dirty:false editing:false events:object id:"travel.data.model.bus-ext-record-1613" index:2 internalid:"ext-record-1613" modified:object phantom:true raw:object store:m 

the 1 webservice normal object in array combining , trying show on grid grid display above type of object.

data : object > see object not have other properties tyre: "eight" color: "blue" 

do need convert model type before push main array?

you can loop through array of normal objects , use ext.create() create model records using data in normal objects.

somewhat this.

var modelobjectarray = [];  ext.array.each(normalobjectarray, function(normalobject, index, normalobjectarrayitself) {     var modelobject = ext.create('complete.model.name', normalobject);     modelobjectarray.push(modelobject); }); 

this way you'll array of objects model records


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -