How exactly does Fixed Columns work
How exactly does Fixed Columns work
For a table with about 8 columns, I want the 2 rightmost to always show even when the window gets smaller (i.e. the 2 columns should never depend on expanding the row to see them.) So I have:
"fixedColumns": {
rightColumns: 2
}
And the extension css/ js correctly loaded.
This config however makes absolutely no noticeable difference to the datatables behaviour from my observation.
What step am I missing out please? Or it the usage different from my understanding?
Answers
Hi @c-myers1 ,
Yep, that's basically it - take a look at this live example here, this has the two right hand-columns fixed. There's something odd with my CSS so it's not layering it properly, but you should see the two columns fixed still.
Hope that helps.
Cheers,
Colin
I have the same requirement and I have never used fixedColumns. All I use for columns that should always show is to assign a class: class="all"
That works when using the responsive extension.
https://datatables.net/extensions/responsive/examples/column-control/classes
Hi @colin, I'm not clear how the selector in $(".datecell", row).datepicker() isolates the element of datecell class in the specific row. I'm not familiar with this jquery selector pattern (the ',row' part) can you point me to any documentation to help my understanding?
@rf1234: I discovered it works as expected where scrolling is allowed. I don't allow scrolling in my table so that explains why it had no effect. Have achieved my objective with responsivePriority/ target config options.
You are looking for Responsive rather than FixedColumns. FixedColumns is used for a scrolling table only.
Responsive however, will hide columns based on the table width automatically. The documentation for how to prioritise columns is available here.
Allan
I agree Allan. From my experience the easiest way was to use "Class Control" (see link above).
These two classes provide all I have needed so far:
all - Always display
none - Don't display as a column, but show in the child row