[pve-devel] [PATCH widget-toolkit] improve multiselect behaviour for checkboxmodel

Dominik Csapak d.csapak at proxmox.com
Wed Apr 22 09:26:23 CEST 2020


when using the mode 'MULTI' for the checkbox selection model,
clicking a row would deselect all others, only clicking exactly on the
checkbox would select multiple rows

this override makes the whole cell of the checkbox behave like the
checkbox. This minimizes misclicks from the user.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
btw. the extjs docs lie, the default is not
'x-grid-row-checker' but '.x-grid-row-checker'
so when setting a different class the '.' is not optional
20 minutes of my life i will not get back...

 Toolkit.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Toolkit.js b/Toolkit.js
index c30aae1..a619336 100644
--- a/Toolkit.js
+++ b/Toolkit.js
@@ -487,6 +487,13 @@ Ext.define('Proxmox.validIdReOverride', {
     validIdRe: /^[a-z_][a-z0-9\-_\@]*$/i,
 });
 
+// use whole checkbox cell to multiselect, not only the checkbox
+Ext.define('Proxmox.selection.CheckboxModel', {
+    override: 'Ext.selection.CheckboxModel',
+
+    checkSelector: '.x-grid-cell-row-checker',
+});
+
 // force alert boxes to be rendered with an Error Icon
 // since Ext.Msg is an object and not a prototype, we need to override it
 // after the framework has been initiated
-- 
2.20.1





More information about the pve-devel mailing list