【问题标题】:Handsontable Column Selection and Sorting IssueHandsontable 列选择和排序问题
【发布时间】:2015-09-12 02:56:13
【问题描述】:

我在我的 SAPUI5 应用程序中使用 Handsontable。我无法滚动到列标题保持固定的 Handsontable Grid。因此,当用户单击列标题对列进行排序时,会选择整列并且滚动到表中的最后一行。此外,排序不仅限于第二列,尽管在设置中指定了它。

以下是我的代码和屏幕截图。请帮我解决问题。

查看:

<HTML xmlns="sap.ui.core" busy="false" busyIndicatorDelay="1000" visible="true"
content="&lt;div id='batchesSheet' class='hot handsontable' style='width: 90%; overflow: hidden'&gt;&lt;/div&gt;"
preferDOM="true" sanitizeContent="false" afterRendering="BatchesHOT">
</HTML> 

控制器:

hotBatches = new Handsontable(container, {
   data: batchesData,
   rowHeaders: true,
   columns: [{data: "User", readOnly: true}, {data: "Timestamp", readOnly: true}, {data: "Status", readOnly: true}, {
      data: "Remarks",
      readOnly: true
   }],
   colHeaders: ["USER", "BATCH SUBMISSION TIME", "STATUS", "REMARKS"],
   colWidths: [100, 220, 180, 350],
   columnSorting: {
      column: 2,
      sortOrder: true
   },
   sortIndicator: true,
   contextMenu: true,
   search: true,
   outsideClickDeselects: false,
   cells: function (row, col, prop) {
      var cellProperties = {};

      if (col === 2) {
         cellProperties.renderer = "statusRenderer";
      }
      else {
         cellProperties.renderer = "textRenderer";
      }
      return cellProperties;
   }
});

【问题讨论】:

  • 抱歉,有什么问题吗?您是否希望标题保持冻结状态?或者当你排序时你的表格一直滚动到底部?或两者?第一个问题是您的overflow:hidden 选项
  • 两者都是@ZekeDroid。两者都是问题!

标签: jquery css html sapui5 handsontable


【解决方案1】:

好的,要解决这两个问题,您可以执行以下操作:

要让您的标题保持冻结状态,请将以下内容添加到表的初始化中:

fixedRowsTop: 0

要使滚动效果更好,请添加 overflow:auto 而不是 overflow:hidden,就像您现在在 HTML 对象上一样。一直滚动到底部是一个错误,我不确定是什么原因造成的,但要让它滚动到顶部,只需在调用

的更新方法的末尾调用
$("#batchesSheet")[0].scrollTop = 0; // sets scroll all the way to the top

希望有帮助!

【讨论】:

    猜你喜欢
    • 2013-05-16
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 1970-01-01
    • 2013-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多