[pve-devel] [PATCH 2/5] ext5migrate: replace calls to me.model.prototype.fields.each() and Ext.ModelMgr.create
Emmanuel Kasper
e.kasper at proxmox.com
Mon Jun 15 15:31:10 CEST 2015
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
---
www/manager5/data/DiffStore.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/www/manager5/data/DiffStore.js b/www/manager5/data/DiffStore.js
index e77ec0b..62410c2 100644
--- a/www/manager5/data/DiffStore.js
+++ b/www/manager5/data/DiffStore.js
@@ -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());
});
--
2.1.4
More information about the pve-devel
mailing list