【发布时间】:2015-06-03 01:20:55
【问题描述】:
我正在尝试实现无限滚动,即在使用 HandsOnTable 插件呈现的表中按需加载数据。该表是使用 SAPUI5 设计的 XML 视图的一部分。我尝试了提到here 的东西。但是即使用户没有滚动到表格的末尾,scrollTop 方法返回的位置值也大于文档和窗口的高度。例如scrollTop 返回的值为 670,$(window).height() 的值为 325。
我也尝试过使用 InfiniteScroll 插件,但没有成功。我的 XML 视图设计如下。
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" controllerName="poc.itemdesc" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Title">
<content>
<Panel xmlns="sap.m" id="iPanel" headerText="Items table"
width="100%" height="auto" expandable="false" expanded="false"
expandAnimation="true" expand="">
<content>
<HTML xmlns="sap.ui.core" id="HTMLCon" busy="false"
busyIndicatorDelay="1000" visible="true"
content="<div id='sheetContainer' style='width: 100%; height: 550px; overflow: auto' data-originalstyle='width: 100%; height: 450px; overflow: auto' class='handsontable'></div>"
preferDOM="true" sanitizeContent="false" afterRendering="HandsOnTbl">
</HTML>
</content> <!-- sap.ui.core.Control -->
</Panel>
</content>
</Page>
HandsOnTable 控制器的代码如下,
HandsOnTbl : function(oEvent){
var container = document.getElementById('sheetContainer');
console.log(container);
var settingsHOT = {
data : Handsontable.helper.createSpreadsheetData(500, 10),
colHeaders : [ "Item #",
"Attribute Name", "Attribute Value",
"Attribute Name", "Attribute Value",
"Attribute Name", "Attribute Value",
],
contextMenuCopyPaste : {
swfPath : "res/ZeroClipboard.swf"
},
search : true,
rowHeaders : true,
contextMenu : true
};
HOT = new Handsontable(container, settingsHOT);
}
请帮忙实现无限滚动。
【问题讨论】:
标签: jquery jquery-plugins infinite-scroll sapui5 handsontable