You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let container =document.querySelector("#changelist-form .results");
19
-
let paginator =document.querySelector("p.paginator");
20
-
if (!container ||!paginator) {
21
-
return;
18
+
if (window.matchMedia('screen and (min-width: 800px)').matches) {
19
+
let container =document.querySelector("#changelist-form .results");
20
+
let paginator =document.querySelector("p.paginator");
21
+
if (!container ||!paginator) {
22
+
return;
23
+
}
24
+
let height =
25
+
window.innerHeight-
26
+
container.getBoundingClientRect().top-
27
+
paginator.getBoundingClientRect().height-
28
+
10;
29
+
container.style.overflowY="auto";
30
+
container.style.height= height +"px";
22
31
}
23
-
let height =
24
-
window.innerHeight-
25
-
container.getBoundingClientRect().top-
26
-
paginator.getBoundingClientRect().height-
27
-
10;
28
-
container.style.overflowY="auto";
29
-
container.style.height= height +"px";
30
32
}
31
33
window.addEventListener("load", resizeTable);
32
34
</script>
33
35
```
36
+
I added the `window.matchMedia()` check when I realized that this approach wasn't useful at mobile screen sizes.
37
+
34
38
Here `#changelist-form .results` is a `<div>` that wraps the main table on the page, and `p.paginator` is the pagination links shown directly below the table. I decided to set the vertically scrollable height to `window height - top-of-table - paginator height - 10px`.
35
39
36
40
I added this code to my project's custom `admin/base_site.html` template, which now looks something like this:
0 commit comments