Dashboards & Visualizations

Using CSS to Apply a Scroll Lock on the first few columns on my table

ahallak2016
Explorer

Hi all,

I would just like to mention that I'm horrible with CSS and unfortunately am tackling a problem that is way outside my comfort zone.

I would like to freeze the first few columns (first 3 or 4 columns) so that when a user is scrolling right on the table, these columns remain visible on the screen. Basically, I'm trying to replicate the pane freeze feature in excel but am experiencing alot of difficulty achieving this.

Currently, I have a table:

<row>
   <panel>
      <table id="table1">
         <search base="base">
            <query>| table region location dept * total</query>
         </search>
       </table>
   </panel>
</row>

I have some basic CSS (which isn't working):

#table1.table-wrapper{
   overflow-x:scroll;
   overflow-y:visible;
   width:250px;
   margin-left:120px;
}

#table1.td{
   padding:5px 20px;
   width:100px;
}

#table1.th{
   padding:5px 20px;
   width: 100px;
}

#table1.th:first-child{
   position:fixed;
   left:5px;
}
Tags (2)
0 Karma

sandeepmakkena
Contributor

Add "position: absolute;" first 3 or 4 columns what you wanted to be freeze.

Something like this
.headcol {
position: absolute;
width: 5em;
left: 0;
top: auto;
border-top-width: 1px;
/only relevant for first row/
margin-top: -1px;
/compensate for top border/
}

0 Karma

sandeepmakkena
Contributor

Did this work ?

0 Karma

mpreddy
Communicator

Hi ,

Any one have working code(java script or css) to freeze ONLY first column when scrolling that table to right or left, I had a table with 65 columns.

Thanks

0 Karma

nagar57
Communicator

Have you made it working ?? I also have the same requirement but don't have any knowledge of CSS and JS.

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...