Commit cb3cbbcd authored by Emmanuel Kasper's avatar Emmanuel Kasper Committed by Dietmar Maurer

ext5migrate: replace calls to me.model.prototype.fields.each() and Ext.ModelMgr.create

on ExtJS4, me.model.prototype.fields is a config object
containing all the fields of the model, this object has properties like length, keys
on ExtJS 5, me.model.prototype.fields is an array of config object
that we have to iterate to get the field name

Ext.ModelMgr.create() is non-working in ExtJS5
parent 782ff121
......@@ -35,15 +35,15 @@ Ext.define('PVE.data.DiffStore', {
var olditem = me.getById(id);
if (olditem) {
olditem.beginEdit();
me.model.prototype.fields.eachKey(function(field) {
if (olditem.data[field] !== data[field]) {
olditem.set(field, data[field]);
Ext.Array.each(me.model.prototype.fields, function(field) {
if (olditem.data[field.name] !== data[field.name]) {
olditem.set(field.name, data[field.name]);
}
});
olditem.endEdit(true);
olditem.commit();
} else {
var newrec = Ext.ModelMgr.create(data, me.model, id);
var newrec = Ext.create(me.model, data);
var pos = (me.appendAtStart && !first_load) ? 0 : me.data.length;
me.insert(pos, newrec);
}
......@@ -64,7 +64,7 @@ Ext.define('PVE.data.DiffStore', {
me.remove(olditem);
}
});
rstore.each(function(item) {
cond_add_item(item.data, item.getId());
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment