typescript ag 网格水平滚动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42293612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ag grid horizontal scroll
提问by Poonam Thote
I have used ag-grid ng in angular application. when number of columns exceeds not getting the horizontal scroll bar.
我在角度应用程序中使用了 ag-grid ng。当列数超过没有得到水平滚动条。
回答by M. Araya
Are you sure is because of the number of columns? I had the same problem and the solution was take off the pinned option of every column.
你确定是因为列数?我遇到了同样的问题,解决方案是取消每列的固定选项。
For example if you have this:
例如,如果你有这个:
{headerName: "Athlete", field: "athlete", width: 150, pinned: 'left'}
it has to be:
它一定要是:
{headerName: "Athlete", field: "athlete", width: 150}
回答by Sumukh Bhandarkar
You can just say,
你只能说,
gridOptions.api.sizeColumnsToFit();
This will set the columns width and hence remove horizontal scrolling.
这将设置列宽,从而删除水平滚动。
回答by petehotchkiss
Sure you haven't got the suppressHorizontalScrollproperty on the gridOptionsobject set to true have you ?
确定您还没有将gridOptions对象上的抑制水平滚动属性设置为 true 是吗?
var gridOptionsTop = {
columnDefs: columnDefs,
// don't show the horizontal scrollbar on the top grid
suppressHorizontalScroll: false,
enableSorting: true,
};