function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shakir Beg 23Shakir Beg 23 

freeze 1st column in lightning datatable

Hi,
I would like to freeze first and second column of datatable in lightning compoment. 
I have done before the requirement in Visualforce with using JQuery third party libraries. Below are VF code.
<apex:includeScript value="/support/console/22.0/integration.js"/>
and a jscript file uploaded in static resource. please see below VF - javascript code.

  <script type="text/javascript">function setFocusOnLoad() {}     
            $(document).ready(function() {            
                setTabWidth();
                jQuery("#fixTable").tableHeadFixer({
                    head: true,
                    left: 2,
                    right: 0
                });                
            });

Now, we are migrating this functionality to lightning. But i am facing challenge to freeze cloumn with using horizontal scroll bar. i.e. when i scroll horizontally first & second column shoud be fix.

If any one has an idea then please help me on this.

Thanks,
Shakir 
Maharajan CMaharajan C
Hi Shakir,

Please refer the below link:

https://salesforce.stackexchange.com/questions/263093/freeze-first-column-in-horizontal-scroll-on-lightning-data-table-salesforce

Thanks,
Maharajan.C
Shakir Beg 23Shakir Beg 23
Thanks Maharajan.

I have tried the given solution but its not working. Can you provide more detail for freezing datatable column.

Below css are sufficient or need to add any thing. 

.THIS table tr td:first-child { position:sticky; z-index: 1 }

Thanks,
Shakir