[pve-devel] r5876 - in pve-manager/pve2/www/new: grid qemu
svn-commits at proxmox.com
svn-commits at proxmox.com
Mon Apr 25 12:13:02 CEST 2011
Author: dietmar
Date: 2011-04-25 12:13:02 +0200 (Mon, 25 Apr 2011)
New Revision: 5876
Modified:
pve-manager/pve2/www/new/grid/ObjectGrid.js
pve-manager/pve2/www/new/qemu/HardwareView.js
Log:
use predefined order
Modified: pve-manager/pve2/www/new/grid/ObjectGrid.js
===================================================================
--- pve-manager/pve2/www/new/grid/ObjectGrid.js 2011-04-25 09:11:06 UTC (rev 5875)
+++ pve-manager/pve2/www/new/grid/ObjectGrid.js 2011-04-25 10:13:02 UTC (rev 5876)
@@ -56,40 +56,46 @@
var item = rstore.data.get(olditem.data.key);
if (!item) {
if (!(rows && rows[olditem.data.key] &&
- Ext.isDefined(rows[olditem.data.key].defaultValue)))
+ Ext.isDefined(rows[olditem.data.key].defaultValue))) {
store.remove(olditem);
+ }
}
});
// add/update items
- rstore.each(function(item) {
- if (rows && !rows[item.data.key])
- return;
- var olditem = store.data.get(item.data.key);
+
+ var cond_add_item = function(data, olditem) {
if (olditem) {
olditem.beginEdit()
- olditem.set('value', item.data.value);
+ olditem.set('value', data.value);
olditem.endEdit(true);
olditem.commit();
} else {
var newrec = Ext.ModelMgr.create(
- item.data, store.model, item.data.key);
+ data, store.model, data.key);
store.add(newrec);
}
- });
-
- // add default value
+ };
+
if (rows) {
Ext.Object.each(rows, function(key, rowdef) {
- if (store.data.get(key) || !Ext.isDefined(rowdef.defaultValue))
- return;
- var newrec = Ext.ModelMgr.create(
- { key: key, value: rowdef.defaultValue },
- store.model, key);
- store.add(newrec);
+ var olditem = (store.snapshot || store.data).get(key);
+ var item = rstore.data.get(key);
+ if (!item) {
+ if (!Ext.isDefined(rowdef.defaultValue))
+ return;
+ var data = { key: key, value: rowdef.defaultValue };
+ cond_add_item(data, olditem);
+ } else
+ cond_add_item(item.data, olditem);
});
+ } else {
+ rstore.each(function(item) {
+ var olditem = (store.snapshot || store.data).get(item.data.key);
+ cond_add_item(item.data, olditem);
+ });
}
-
+
store.filterBy(function(item) {
if (rows && rows[item.data.key] &&
(rows[item.data.key].visible === false))
@@ -97,7 +103,6 @@
return true;
});
- store.sort();
store.resumeEvents();
store.fireEvent('datachanged', store);
}
Modified: pve-manager/pve2/www/new/qemu/HardwareView.js
===================================================================
--- pve-manager/pve2/www/new/qemu/HardwareView.js 2011-04-25 09:11:06 UTC (rev 5875)
+++ pve-manager/pve2/www/new/qemu/HardwareView.js 2011-04-25 10:13:02 UTC (rev 5876)
@@ -103,7 +103,7 @@
rows: rows,
columns: [
{
- header: 'Name',
+ header: 'Type',
width: 120,
dataIndex: 'key',
renderer: render_key
More information about the pve-devel
mailing list