[pve-devel] [PATCH 2/2] pending grid 1 column

Alexandre Derumier aderumier at odiso.com
Tue Dec 16 14:59:30 CET 2014


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager/grid/ObjectGrid2.js |   55 ++++++++++-----------------------------
 1 file changed, 14 insertions(+), 41 deletions(-)

diff --git a/www/manager/grid/ObjectGrid2.js b/www/manager/grid/ObjectGrid2.js
index c2535b6..a2c38dc 100644
--- a/www/manager/grid/ObjectGrid2.js
+++ b/www/manager/grid/ObjectGrid2.js
@@ -24,42 +24,28 @@ Ext.define('PVE.grid.ObjectGrid2', {
 	var key = record.data.key;
 	var rowdef = (rows && rows[key]) ?  rows[key] : {};
 	var renderer = rowdef.renderer;
+	var current = '';
+	var pendingdelete = '';
+	var pending = '';
+
 	if (renderer) {
-	    return renderer(value, metaData, record, rowIndex, colIndex, store);
+	    current = renderer(value, metaData, record, rowIndex, colIndex, store);
+	    pending = renderer(record.data['pending'], metaData, record, rowIndex, colIndex, store);
+	}else{
+	    current = value;
+	    pending = record.data['pending'];
 	}
-
-	return value;
-    },
-
-    renderPending: function(value, metaData, record, rowIndex, colIndex, store) {
-	var me = this;
-	var rows = me.rows;
-	var key = record.data.key;
-	var rowdef = (rows && rows[key]) ?  rows[key] : {};
-	var renderer = rowdef.renderer;
-	if (!value){
-	    return '';
+	if(record.data['delete']){
+	    pendingdelete = '<div style="text-decoration: line-through;">'+ current +'</div>';
 	}
 
-	if (renderer) {
-	    return renderer(value, metaData, record, rowIndex, colIndex, store);
+	value = current;
+	if(pending || pendingdelete){
+	    value += '<div style="color:red"> pending:' + pending + pendingdelete + '</div>';
 	}
-
 	return value;
     },
 
-    renderDelete: function(value, metaData, record, rowIndex, colIndex, store) {
-	var me = this;
-	var rows = me.rows;
-	var key = record.data.key;
-	var rowdef = (rows && rows[key]) ?  rows[key] : {};
-	if (!value){
-	    return '';
-	}else{
-	    return 'delete';
-	}
-    },
-
     initComponent : function() {
 	var me = this;
 
@@ -133,21 +119,8 @@ Ext.define('PVE.grid.ObjectGrid2', {
 		{
 		    flex: 1,
 		    header: gettext('Value'),
-		    width: 100,
 		    dataIndex: 'value',
 		    renderer: me.renderValue
-		},
-		{
-		    flex: 1,
-		    header: gettext('Pending'),
-		    dataIndex: 'pending',
-		    renderer: me.renderPending
-		},
-		{
-		    flex: 1,
-		    header: gettext('Pending Delete'),
-		    dataIndex: 'delete',
-		    renderer: me.renderDelete
 		}
 	    ]
 	});
-- 
1.7.10.4




More information about the pve-devel mailing list