gpt4 book ai didi

javascript - 使用 Kendo Mobile,如何防止 View 滚动?

转载 作者:行者123 更新时间:2023-11-30 17:33:28 25 4
gpt4 key购买 nike

我有 Kendo Mobile View,它具有三个可折叠区域 div。我有一个无尽的滚动 kendoMobileListView,每个都有 css overflow = auto。当我滚动时,它会滚动整个 View 而不是 div 中的 ListView 。用户界面如下所示:

enter image description here

我的 View 标记如下:

    <!-- Contact Search View-->
<div id="employee-contact-search-view"
data-role="view"
data-model="klas.contactSearchViewModel"
data-init="klas.contactSearchViewModel.initalizeContactSearch"
data-layout="drawer-layout"
data-title="Search Contacts">
<div style="text-align:center;">
<input id="contactSearchBox" type="search" placeholder="Enter Contact Name to Find" class="contactSearchInput" />
</div>
<div id="contactSearchResultsArea" class="contact-search-results-area-hidden">
<div class="search-collapose-buttom">
Provider Contacts
</div>
<div class="collapose-contact-area collapose-contact-area-open">
<div>
<ul id="providerContactListView" data-role="listview"></ul>
</div>
</div>
<div class="search-collapose-buttom">
Vendors Contacts
</div>
<div class="collapose-contact-area collapose-contact-area-closed">
<ul id="vendorContactListView" data-role="listview"></ul>
</div>
<div class="search-collapose-buttom">
Employees
</div>
<div class="collapose-contact-area collapose-contact-area-closed">
<ul id="employeeContactListView" data-role="listview"></ul>
</div>
</div>
</div>

我初始化第一个无限滚动条的 JavaScript 是:

      var dataSource = new kendo.data.DataSource({
pageSize: 20,
page: 1,
serverPaging: true,
transport: {
read: {
url: klas.apiUrl + "/search/providers/",
dataType: "json"
},
parameterMap: function (options) {
debugger;
var parameters = {
searchString: $('#contactSearchBox').val(),
rowsPerPage: options.pageSize,
row: options.take,
};

return parameters;
}
},
schema: {
data: function (data) {
return data.Data;

},
total: function (data) {
return data.Count;
}
}
});

$("#providerContactListView").kendoMobileListView({
endlessScroll: true,
dataSource: dataSource,
template: $("#contact-search-list-template").text(),
scrollTreshold: 10
});

允许用户滚动 ListView 的 Div 的 CSS 如下所示:

.collapose-contact-area-open { 
display: block;
background-color: white;
border: 1px solid gray;
height: 63vh;
margin-left:2px;
margin-right:2px;
border-radius:0 0 4px 4px;
overflow:auto;
}

我希望固定 View 并滚动多 View 。有什么建议吗?

最佳答案

您是否尝试过将 View 设置为 stretch

<div id="employee-contact-search-view"
data-role="view"
data-stretch="true" ...

文档说:

If set to true, the view will stretch its child contents to occupy the entire view, while disabling kinetic scrolling. Useful if the view contains an image or a map.

关于javascript - 使用 Kendo Mobile,如何防止 View 滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22511116/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com