horizontal scroll in datagrid #113

This commit is contained in:
Jan Prochazka
2021-05-16 14:21:36 +02:00
parent 91741655b7
commit be053acf3c

View File

@@ -171,6 +171,7 @@
if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value); if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value);
return value; return value;
} }
</script> </script>
<script lang="ts"> <script lang="ts">
@@ -663,6 +664,24 @@
} }
function handleGridWheel(event) { function handleGridWheel(event) {
if (event.shiftKey) {
let newFirstVisibleColumnScrollIndex = firstVisibleColumnScrollIndex;
if (event.deltaY > 0) {
newFirstVisibleColumnScrollIndex++;
}
if (event.deltaY < 0) {
newFirstVisibleColumnScrollIndex--;
}
if (newFirstVisibleColumnScrollIndex > maxScrollColumn) {
newFirstVisibleColumnScrollIndex = maxScrollColumn;
}
if (newFirstVisibleColumnScrollIndex < 0) {
newFirstVisibleColumnScrollIndex = 0;
}
firstVisibleColumnScrollIndex = newFirstVisibleColumnScrollIndex;
domHorizontalScroll.scroll(newFirstVisibleColumnScrollIndex);
} else {
let newFirstVisibleRowScrollIndex = firstVisibleRowScrollIndex; let newFirstVisibleRowScrollIndex = firstVisibleRowScrollIndex;
if (event.deltaY > 0) { if (event.deltaY > 0) {
newFirstVisibleRowScrollIndex += wheelRowCount; newFirstVisibleRowScrollIndex += wheelRowCount;
@@ -681,6 +700,7 @@
domVerticalScroll.scroll(newFirstVisibleRowScrollIndex); domVerticalScroll.scroll(newFirstVisibleRowScrollIndex);
} }
}
function getSelectedRowIndexes() { function getSelectedRowIndexes() {
if (selectedCells.find(x => x[0] == 'header')) return _.range(0, grider.rowCount); if (selectedCells.find(x => x[0] == 'header')) return _.range(0, grider.rowCount);
@@ -958,6 +978,7 @@
); );
const menu = getContextMenu(); const menu = getContextMenu();
</script> </script>
{#if !display || (!isDynamicStructure && (!columns || columns.length == 0))} {#if !display || (!isDynamicStructure && (!columns || columns.length == 0))}
@@ -1164,4 +1185,5 @@
right: 40px; right: 40px;
bottom: 20px; bottom: 20px;
} }
</style> </style>