ce
ce copied to clipboard
Selection is disappearing when select rows from bottom to top / select columns from right to left
Step 1: Select rows from bottom to top / select columns from right to left
Step 2: Right-click on the selected area
Expected result: Selection should not disappear Actual result: Selection is disappearing
Hi,
I can't reproduct your error. But you have index text align set to left, maybe it's link with that ? I have checked on that : https://bossanova.uk/jspreadsheet/v4/
I have recorded an example of the error https://www.youtube.com/watch?v=Q-EEXeb7DUE
@hodeware hi there, any good luck? Because i am still stuck in this issue.
Hi,
While waiting for the patch on jspreadsheet CE, you can use this script
add on your event onload
const myTable = jspreadsheet(HTMLDomElement, {
/* ..your config.. */
onload: function(instance) {
instance.el.addEventListener("contextmenu", function(e) {
const currentSelection = instance.selectedCell;
const x1 = Math.min(parseInt(currentSelection[0]), parseInt(currentSelection[2])),
x2 = Math.max(parseInt(currentSelection[0]), parseInt(currentSelection[2]));
const y1 = Math.min(parseInt(currentSelection[1]), parseInt(currentSelection[3])),
y2 = Math.max(parseInt(currentSelection[1]), parseInt(currentSelection[3]));
if(parseInt(currentSelection[0]) != x1 || parseInt(currentSelection[1]) != y1) {
instance.updateSelectionFromCoords(x1, y1, x2, y2);
}
});
}
});
@GBonnaire I had to update a little bit your script for my needs, but it works !
onload = async (instance, jexcel) => {
instance.addEventListener('contextmenu', function (e) {
const currentSelection = jexcel.selectedCell;
const x1 = Math.min(
parseInt(currentSelection[0]),
parseInt(currentSelection[2])
),
x2 = Math.max(
parseInt(currentSelection[0]),
parseInt(currentSelection[2])
);
const y1 = Math.min(
parseInt(currentSelection[1]),
parseInt(currentSelection[3])
),
y2 = Math.max(
parseInt(currentSelection[1]),
parseInt(currentSelection[3])
);
if (
parseInt(currentSelection[0]) != x1 ||
parseInt(currentSelection[1]) != y1
) {
jexcel.updateSelectionFromCoords(x1, y1, x2, y2);
}
});
... // more content
};