【问题标题】:Enable horizontal scroll bar in table in jqgrid在 jqgrid 的表格中启用水平滚动条
【发布时间】:2020-07-02 09:51:54
【问题描述】:

当 jqgrid 中存在分组文本不适合表格宽度时,我面临启用水平滚动的问题。

表格宽度约为屏幕的50%,分组文本长度为300 characters,在向表格添加溢出属性后,没有添加滚动条并且文本被隐藏。

图像行中的突出显示问题

【问题讨论】:

  • 分享 HTML 和 CSS 代码。
  • 无法共享代码,但我已为探针添加了图像。

标签: css jqgrid scrollbar


【解决方案1】:

在你的 table 中使用 overflow-y:scroll 应该可以解决这个问题。

设置shrinkToFit : false 或将您的元素设置为上述方式。

<div style="width:100px;overflow:auto;"><table id="yourTable"></table><div>

你可以使用 CSS。

yourTableSelector{
      width:50%;
      overflow-y:scroll;
       }

一个例子:

.scrolling-wrapper {
  height:100px;
 width:50%;
 border:1px solid red;
  overflow-y: scroll;
 
}
 
<div class="scrolling-wrapper">
  <div>There are two different ways to make these divs scroll horizontally and which path you choose will probably come down to personal preference and/or browser support.
  There are two different ways to make these divs scroll horizontally and which path you choose will probably come down to personal preference and/or browser support.
  There are two different ways to make these divs scroll horizontally and which path you choose will probably come down to personal preference and/or browser support.</div> 
</div>

【讨论】:

  • 感谢您的评论。但是代码更改不起作用。我添加了图片来说明我的问题。
  • 你的意思是shrinkToFit : false这对你不起作用或使用overflow:auto
  • 这里的问题是分组文本溢出时没有添加滚动条。我想要那个案例的滚动条
  • 我没明白这是什么意思,如果你能分享一个sn-p,我可以尝试帮助你。
  • 我得到了代码中问题的解决方案。 table-layout 属性设置为固定,我将其更改为自动,然后滚动条正在工作。
猜你喜欢
  • 2011-03-06
  • 1970-01-01
  • 1970-01-01
  • 2023-03-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-04
  • 2016-03-23
相关资源
最近更新 更多