[pmg-devel] [PATCH pmg-gui] fix #2844: MailTracker: do not collapse rows with double click

Dominik Csapak d.csapak at proxmox.com
Wed Jul 15 12:32:37 CEST 2020


so that users can select words with double click, but can still expand
the logs with it

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
not sure about it, since the user now cannot collapse the log
with doubleclick anymore...

 js/MailTracker.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/js/MailTracker.js b/js/MailTracker.js
index 34b6d6f..9cd2b9f 100644
--- a/js/MailTracker.js
+++ b/js/MailTracker.js
@@ -245,6 +245,7 @@ Ext.define('PMG.MailTracker', {
     plugins: [
 	{
 	    ptype: 'rowexpander',
+	    expandOnDblClick: false,
 	    rowBodyTpl: '<p class="logs">{logs}</p>'
 	}
     ],
@@ -309,9 +310,23 @@ Ext.define('PMG.MailTracker', {
 	    });
 	},
 
+	// only expand row on dblclick, but do not collapse
+	expand: function(view, record, row, rowIdx, e) {
+	    // inspired by RowExpander.js
+	    let rowNode = view.getNode(rowIdx);
+	    let normalRow = Ext.fly(rowNode);
+
+	    let collapsedCls = view.rowBodyFeature.rowCollapsedCls;
+
+	    if (normalRow.hasCls(collapsedCls)) {
+		view.rowBodyFeature.rowExpander.toggleRow(rowIdx, record);
+	    }
+	},
+
 	control: {
 	    'gridview': {
-		expandbody: 'showDetails'
+		expandbody: 'showDetails',
+		itemdblclick: 'expand',
 	    }
 	}
     },
-- 
2.20.1





More information about the pmg-devel mailing list