File tree Expand file tree Collapse file tree
templates/easy_admin_overrides Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,3 +153,10 @@ body.list table tbody td.dashboard--table-answer {
153153 margin-top : 2em ;
154154 margin-bottom : 2em ;
155155}
156+
157+
158+ /* Fix position of table heads while scrolling */
159+ .affix {
160+ top : 0 ;
161+ z-index : 1040 ;
162+ }
Original file line number Diff line number Diff line change 128128 });
129129 }
130130 }, false );
131+
132+ // Function for setting static size on table heads. We need to do this to keep the same width as the table when setting the theads position to fixed.
133+ // One could argue that we should use position sticky instead. But since we manipulate overflow on thead parents that can't be done.
134+ function setTheadSize () {
135+ // Set width of thaed
136+ $ (" table thead" ).each (function () {
137+ $ (this ).width ($ (this ).width ());
138+ });
139+ // Set the with of the column headers in thead
140+ $ (" table thead th" ).each (function () {
141+ $ (this ).width ($ (this ).width ());
142+ });
143+ // Affix table header when this reaches upper borwser edge.
144+ $ (' table thead' ).affix ({
145+ offset: 0
146+ })
147+ }
148+ window .addEventListener (' resize' , setTheadSize);
149+ setTheadSize ();
131150 </script >
132151{% endblock %}
You can’t perform that action at this time.
0 commit comments