Fix so Shift selection also works on list selection checkboxes

pull/6114/head
Aleksander Machniak 7 years ago
parent 307d682ad2
commit fbc4486881

@ -403,21 +403,30 @@ insert_row: function(row, before)
} }
if (this.checkbox_selection) { if (this.checkbox_selection) {
var cell = document.createElement(this.col_tagname()), var key, cell = document.createElement(this.col_tagname()),
chbox = document.createElement('input'); chbox = document.createElement('input');
chbox.type = 'checkbox'; chbox.type = 'checkbox';
chbox.onchange = function(e) { chbox.onchange = function(e) {
self.select_row(row.uid, CONTROL_KEY, true); self.select_row(row.uid, key || CONTROL_KEY, true);
e.stopPropagation(); e.stopPropagation();
key = null;
}; };
chbox.onmousedown = function(e) {
key = rcube_event.get_modifier(e);
};
cell.className = 'selection'; cell.className = 'selection';
// make the whole cell "touchable" for touch devices
cell.onclick = function(e) { cell.onclick = function(e) {
// this event handler fixes checkbox selection on touch devices if (!$(e.target).is('input')) {
if (e.target.nodeName != 'INPUT') key = rcube_event.get_modifier(e);
chbox.click(); $(chbox).prop('checked', !chbox.checked).change();
}
e.stopPropagation(); e.stopPropagation();
}; };
cell.appendChild(chbox); cell.appendChild(chbox);
row.insertBefore(cell, row.firstChild); row.insertBefore(cell, row.firstChild);

Loading…
Cancel
Save