How to use scrollX with a fixed table width

How to use scrollX with a fixed table width

troyleetroylee Posts: 10Questions: 5Answers: 0

Reason for fixed table width: when filtering the table, it auto-adjusts the columns; this was especially annoying when trying to alternate between asc/desc as the mouse would no longer be at the right position. the fix for this was to set my css like so:

#table_wrapper {
    width: 1800px;
}

Problem now: I want to be able to take advantage of the "scrollX" option but want my table to remain the same width. testing this, is simply just resizing the window to half. at the moment I can achieve two possibilities:
1. w/o table width css: scrollX works, but now the columns get resized and do not respect the fixed column widths; issue stated at the top reappears
2. w/ table width css: scrollX does not work, but the table remains the same size and i still do have some "scrolling" capability as i can scroll with the window but not the table

I'm content with scenario 2 and that is what I'm settling with for now, but I was wondering if there was any way for me to get these two things to work together.

Answers

  • troyleetroylee Posts: 10Questions: 5Answers: 0

    Figured out it was a very easy fix... just define the width in the actual table element instead of the wrapper.

    #table {
        width: 1800px;
    }
    

    To be honest, I really think I tried this before and it didn't work, but I'll take it lol.

Sign In or Register to comment.