This is not included as a built-in feature, but there is a workaround one of our customers shared with us. I don't know if that will work for you though. I will post the instructions here, so you can decide if this is in the scope of your skills. Since this would be developed as a custom solution, I wouldn't be able to help you out.
"I actually created a fixed header and column using translation of x and y (no absolute or fixed position used), very similar to the fixed header provided by weihs5 on this site, and here's one solution, take a look:
First of all, you gotta set the z-index for each component below:
And here's the scrollBlock() part, it is ugly though, but it works for me though. (noted: the numbers work for my theme, if it is not working correctly on yours, then try to adjust the number until it fits.)
function scrollBlock(){ var table = document.querySelector('table');
var top = table.getBoundingClientRect().top;
top = document.body.className.search('admin') > 0 ? top - 32 : top + 3; // this value can change
var left = table.getBoundingClientRect().left;
if(left >= 20){ // before scrolling left (before transforming)
if(top >= 0){ // before reaching header bar
jQuery("#table_1 thead th").css("transform", "translateY(0px)");
translate(jQuery("table th:nth-child(1)"), 0, 0);
translate(jQuery("table td:nth-child(1)"), 0, 0);
} else{ // after reaching header bar
jQuery("#table_1 thead th").css("transform", "translateY( " + (-top) + "px)");
translate(jQuery("table th:nth-child(1)"), 0, -top);
translate(jQuery("table td:nth-child(1)"), 0, 0);
}
} else{ // after scrolling left
if(top >= 0){
jQuery("#table_1 thead th").css("transform", "translateY(0px)");
translate(jQuery("table th:nth-child(1)"), -left + 46, 0);
translate(jQuery("table td:nth-child(1)"), -left + 46, 0);
} else{
jQuery("#table_1 thead th").css("transform", "translateY( " + (-top) + "px)");
translate(jQuery("table th:nth-child(1)"), -left + 46, -top);
translate(jQuery("table td:nth-child(1)"), -left + 46, 0);
}
}
}
function translate(element, x, y) {
var translation = "translate(" + x + "px," + y + "px)"
element.css({
"transform": translation,
"-ms-transform": translation,
"-webkit-transform": translation,
"-o-transform": translation,
"-moz-transform": translation,
});
}
It is kind of messy, you definitely can't copy and paste and expect it to work for you. You need to spend some time to figure it out. Hope this helps everyone!"
Hi
I am looking to integrate this table https://drive.google.com/file/d/1VO_3jXMD3zNbugPh-3sg-zhlraAFhRFQ/view?usp=sharing
into my site and just wanted to know if your plugin may have column freeze function or not.
As you can see my table are wider than normal so in case I can not have the first column freeze it will be a little bit difficult to read.
Appreciate your reply
Hello islam
Thank you for your interest in our plugin.
This is not included as a built-in feature, but there is a workaround one of our customers shared with us. I don't know if that will work for you though. I will post the instructions here, so you can decide if this is in the scope of your skills. Since this would be developed as a custom solution, I wouldn't be able to help you out.
"I actually created a fixed header and column using translation of x and y (no absolute or fixed position used), very similar to the fixed header provided by weihs5 on this site, and here's one solution, take a look:
First of all, you gotta set the z-index for each component below:
Then you gotta add listener on scroll like this:
If your table is set to be scrollable, then you might want to add this in as well:
And here's the scrollBlock() part, it is ugly though, but it works for me though. (noted: the numbers work for my theme, if it is not working correctly on yours, then try to adjust the number until it fits.)
It is kind of messy, you definitely can't copy and paste and expect it to work for you. You need to spend some time to figure it out. Hope this helps everyone!"
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables