Sticky Headers for Table Views

Hi Carl. I created a new post showing how one can freeze columns. I don’t know much about CSS coding, I managed to do it with the help of ChatGPT. If you have the time, please take a look at it.

Link to post

Thanks! This was exactly what I needed! I was hoping to put sticky headers on most, if not all our pages. I can’t seem to add another view successfully to the code, though. Can you please let us know:

  1. Is there a way to add sticky headers on all the pages?
  2. How do you edit the code to add sticky headers to additional pages?

Thank you very much!

Hi @Jennifer,

As you may be aware, I’m not a coder. I’m sorry, but I don’t know if it’s possible to have a global snippet to add sticky headers to every table.

That being said, I don’t think I’d want to do that across a whole application personally. Especially as you can vary the view port (height) of each table with the max-height pixel variable.

As I mention in the code example, just repeat for each view that you want to add sticky headers, as per the below example. :+1:

I’ve been using this code for several years with no issues. Almost every client app has a number of views with sticky headers. If you’re finding that it’s not working on multiple views then you may have some other code that is conflicting with it :man_shrugging:

thead {
position:sticky;
top:0px;
z-index:5;
}
#view_1 .kn-table-wrapper {
max-height: 700px;
}
#view_2 .kn-table-wrapper {
max-height: 700px;
}
#view_3 .kn-table-wrapper {
max-height: 700px;
}

2 Likes

Thank you so much! That works perfectly! Truly appreciate your help.

1 Like

For years I have wondered and suggested that this should be a standard builder feature for all tables

1 Like