I am looking for a way, in a SP2019 List, to freeze Column 1 (or Columns 1, 2, 3) when scrolling to the right. I do not have access to SPD. JQuery would be great.
Thank you!
I have one jQuery with content editor web part that I had used in my SharePoint 2013 on-prem server site to freeze the first 2 columns. This may help you but it may require some adjustments as per SP2019.
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
var table = $('.ms-listviewtable');
var firstCol = table.find('tr').find('td:nth-child(1), th:nth-child(1)');
var secondCol = table.find('tr').find('td:nth-child(2), th:nth-child(2)');
firstCol.css({
'position': 'sticky',
'left': '0',
'background': '#fff',
'z-index': '1'
});
secondCol.css({
'position': 'sticky',
'left': '100px', // Adjust this value based on the width of the first column
'background': '#fff',
'z-index': '1'
});
});
</script>