列表高度自适应——DataGrid系列

列表高度自适应


@(Html.DevExtreme().DataGrid<project_record>()
.ID("grid")
.Height(new JS("getHeight"))
……
)

<script>

function getScreenState() {
//屏幕状态 0竖屏 ,1横屏,2未知
if (window.orientation == 0) {
return 0;
}
else if (window.orientation == 90) {
return 1;
}
return 2;
}
function getHeight() {
if (getScreenState() == 0) {
return window.innerWidth - 0.06 * window.innerWidth;
}
else if (getScreenState() == 1) {
return window.innerHeight - 0.06 * window.innerHeight;
}
else {
return window.innerHeight - 0.06 * window.innerHeight
}
}

</script>

posted @ 2023-02-22 14:51  H辉  阅读(136)  评论(0)    收藏  举报