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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...