[pmg-devel] [PATCH pmg-gui 2/2] mobileui: fix list height

Dominik Csapak d.csapak at proxmox.com
Tue Feb 19 12:33:02 CET 2019


the items have different heights depending on theme and type
so use the correct ones

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/mobile/quarantineview.js | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/js/mobile/quarantineview.js b/js/mobile/quarantineview.js
index c2e7e94..7113214 100644
--- a/js/mobile/quarantineview.js
+++ b/js/mobile/quarantineview.js
@@ -135,6 +135,9 @@ class QuarantineView extends Component {
 		renderItem: function(item) {
 		    return me._renderItem(item);
 		},
+		height: function(item) {
+		    return me._calculateHeight(item);
+		},
 		emptyTemplate: '<div class="empty">No data in database</div>'
 	    });
 
@@ -252,6 +255,32 @@ class QuarantineView extends Component {
 	}
 	return false;
     }
+    _calculateHeight(item) {
+	var me = this;
+
+	let height = 48; // default
+
+	if (typeof item === 'object') {
+	    let type = app.theme + '-' + (item.divider? "divider" : 'item');
+	    switch (type) {
+		case 'md-divider':
+		    height = 48;
+		    break;
+		case 'md-item':
+		    height = 54;
+		    break;
+		case 'ios-divider':
+		    height = 31;
+		    break;
+		case 'ios-item':
+		    height = 53;
+		    break;
+		default: ;
+	    }
+	}
+
+	return height;
+    }
     _renderItem(item) {
 	var me = this;
 
-- 
2.11.0




More information about the pmg-devel mailing list