如何删除 SlickGrid 中的标题?
我知道没有 API 可以删除标题行,但我确信可以通过修改一些 CSS 来完成。有什么想法吗?
例如,这里: http://mleibman.github.com/SlickGrid/examples /example4-model.html
CSS 专家! 我需要你的帮助来解决这个问题。 我有兴趣更改删除标题行的包的 CSS 代码。优先考虑可以在包顶部加载的 CSS 代码。 源代码在这里:http://github.com/mleibman/SlickGrid (按“下载源”)
I know that there is no API to remove the header row, but I'm sure it can be done by modifying some CSS. Any ideas ?
For example, here: http://mleibman.github.com/SlickGrid/examples/example4-model.html
CSS experts !
I need your help with this one.
I'm interested in changing the CSS code of the package that removes the header row. CSS code that can be loaded on top of the package is preferred.
The source code is here: http://github.com/mleibman/SlickGrid
(Press "Download Source")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
简而言之,SlickGrid 不支持这样做,至少目前是这样。
CSS 解决方法不起作用,因为 SlickGrid 使用标头中的 DOM 元素来计算视口的尺寸。将其设置为
display:none
会使 SlickGrid 认为网格的宽度为 0 像素。您可以通过执行
$(".slick-header-columns").css("height","0px")
然后调用grid.resizeCanvas( )
消除网格底部剩余的空白。The short answer is that doing this is not supported in SlickGrid, at least at the moment.
The CSS workaround doesn't work because SlickGrid uses the DOM elements in the header to calculate the dimensions of the viewport. Setting it to
display:none
makes SlickGrid think that the grid is 0 pixels wide.You can sort of get around it by doing
$(".slick-header-columns").css("height","0px")
followed by a call togrid.resizeCanvas()
to get rid of the remaining whitespace at the bottom of the grid.只需将以下内容添加到网格选项中:
然后在 css 中添加类似以下内容:
Just add the following to the grid options:
and then in your css put something like:
我遇到了同样的问题,只是不显示就可以了:
I had the same problem and simply not displaying does work:
这可能应该有效:
This should probably work:
添加一行
另一种方法是向 slick.grid.js函数 createColumnHeaders() {
返回;
如果
您将 return 添加到 createColumnHeaders 内的第一行,则似乎会删除标题。
Another way to do this is to add one line to the slick.grid.js
function createColumnHeaders() {
return;
}
if you add a return to the first line inside of createColumnHeaders it seems to remove the headers.
也许晚了,但对我有用
Maybe late, but works for me