I would like to adjust the Kendo-Grid height automatically such as the bottom grid is at 20px
from the bottom of the window.
.--------------------. -
| Navbar | |
| .------------. | |
| | Kendo-Grid | | | Window Height
| | | | |
| '------------' | |
'--------------------' -
My current solution uses Javascript:
<div class="container-fluid">
<div id="grid"></div>
</div>
<script>
$(window).resize(function() {
let height = window.innerHeight - $('#grid').offset().top - 20
$('#grid').css('height', height + 'px')
$('#grid').data("kendoGrid").refresh()
})
</script>
I am wondering if there is a better solution.
I'm assuming here, as your layout might be more specific, but you can try this CSS:
<style>
.container-fluid {
height: 100%;
}
#grid {
height: calc(100% - 20px);
}
</style>
<div class="container-fluid">
<div id="grid"></div>
</div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.