-
-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic column #1144
Dynamic column #1144
Changes from 1 commit
490b5dd
0a22e12
3f2ba21
0d68988
88848ae
cc2e44f
a65e176
3d527c5
3663ac5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -819,6 +819,7 @@ Index.resizableColumns = function () { | |
// init | ||
header.addEventListener('mousedown', function (event) { | ||
if (event.offsetX > header.offsetWidth - 10) { | ||
event.preventDefault(); | ||
currentHeader = header; | ||
startX = event.clientX; | ||
startWidth = header.offsetWidth; | ||
|
@@ -840,6 +841,7 @@ Index.resizableColumns = function () { | |
|
||
function resizeColumn(event) { | ||
if (currentHeader) { | ||
currentHeader.style.cursor = 'col-resize'; | ||
const newWidth = startWidth + (event.clientX - startX); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This calculation is very inaccurate to me some times - I have to drag the mouse pretty far before the column width starts reacting (as seen in the screen recording in the other comment) Some other times, it will violently snap the column width to a very different value as soon as I start sliding. |
||
if (newWidth > 0) { | ||
currentHeader.style.width = newWidth + 'px'; | ||
|
@@ -856,6 +858,8 @@ Index.resizableColumns = function () { | |
document.removeEventListener('mousemove', resizeColumn); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like this function needs a way to block the sort-on-click behavior that datatables has; Currently if I drag to resize a column and release the mouse while in the column, it'll trigger a sort, which is very disorienting and resets the column width. Screen.Recording.2024-12-31.043918.mp4 |
||
document.removeEventListener('mouseup', stopResize); | ||
document.body.style.cursor = 'default'; | ||
|
||
document.location.reload(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes the behavior worse it seems, the columns seemed to resize and remember their size fine without needing a page reload here. In fact it's worse now, since there appears to be some kind of race condition that prevents the column size from being saved in localStorage before the page reloads. |
||
} | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't seem to fix anything for me on Firefox unfortunately.