Closed adjiandov closed 4 years ago
Most likely related to this method which handles Numeric cells.
Fixed with commit: https://github.com/primefaces-extensions/core/commit/946e568d8c8ac40dc8b567c21fadf59ab640e306
You can try adding this Javascript to your page load.
PrimeFaces.widget.ExtSheet.prototype.handleHotBeforeKeyDown = function(e) {
var selectedLast = this.getSelectedLast();
if (!selectedLast) {
return;
}
var row = selectedLast[0];
var col = selectedLast[1];
var celltype = this.getCellMeta(row, col).type;
// prevent Alpha chars in numeric sheet cells
if (celltype === "numeric") {
var evt = e || window.event; // IE support
var key = evt.charCode || evt.keyCode || 0;
// #766 do not block if just CTRL key
if (key === 17) {
return;
}
// check for cut and paste
var isClipboard = false;
var ctrlDown = evt.ctrlKey || evt.metaKey; // Mac support
// Check for Alt+Gr (http://en.wikipedia.org/wiki/AltGr_key)
if (ctrlDown && evt.altKey) isClipboard = false;
// Check for ctrl+c, v and x
else if (ctrlDown && key == 67) isClipboard = true; // c
else if (ctrlDown && key == 86) isClipboard = true; // v
else if (ctrlDown && key == 88) isClipboard = true; // x
// allow backspace, tab, delete, enter, arrows, numbers and keypad numbers
// ONLY home, end, F5, F12, minus (-), period (.)
// console.log('Key: ' + key + ' Shift: ' + e.shiftKey + ' Clipboard: ' + isClipboard);
var isNumeric = ((key == 8) || (key == 9) || (key == 13) ||
(key == 46) || (key == 110) || (key == 116) ||
(key == 123) || (key == 188) || (key == 189) ||
(key == 190) || ((key >= 35) && (key <= 40)) ||
((key >= 48) && (key <= 57)) || ((key >= 96) && (key <= 105)));
if ((!isNumeric && !isClipboard) || e.shiftKey) {
// prevent alpha characters
e.stopImmediatePropagation();
e.preventDefault();
}
}
};
1) Environment PrimeFaces version: 6.2.2 Application server + version: JBoss Wildfly 10.0.0 Affected browsers: all 2) Expected behavior Whenever I try to select several cells with space between them (with 'ctrl') the clicked cells should be marked as selected. ...
3) Actual behavior Whenever a numeric cell is clicked then another numeric cell is clicked while holding ctrl, the first cell looses selection and only the second cell is selected (the same as if ctrl was not pressed). The issue is reproducible always when the first selected cell is numeric. If the start of the selection is a non-numeric cell the issue is not reproducible. ..
4) Steps to reproduce Open the showcase (Basic Usage) and try to multi-select several cells in the Price column with ctrl pressed