简体   繁体   English

Slickgrid:使新添加的列与其他列宽度相同

[英]Slickgrid: Make newly added columns same width as others

I have a Slickgrid with multiple columns.我有一个包含多个列的 Slickgrid。 None of them have a width value, so they all automatically have equal widths.它们都没有宽度值,因此它们都自动具有相等的宽度。

I initiate the grid and, depending on the situation, will add more columns to the grid using grid.setColumns() .我启动网格,并根据情况使用grid.setColumns()向网格添加更多列。

The grid adds the columns correctly, but they are less wide than all the other previously created columns.网格正确添加了列,但它们的宽度小于所有其他先前创建的列。

在此处输入图像描述

As you can see, the "Stream" column is smaller than the others.如您所见,“Stream”列比其他列小。

How can I set the newly added column's width equal to the other's width?如何将新添加的列的宽度设置为等于其他列的宽度?

Edit: My Version is Slickgrid v2.3编辑:我的版本是 Slickgrid v2.3

If you want it to resize as it would when loading the grid without any defined width then you can call the following (which is the same as what the option "Force Fit Columns" would do but only once)如果您希望它像加载没有任何定义宽度的网格时那样调整大小,那么您可以调用以下命令(这与选项“Force Fit Columns”所做的相同,但只有一次)

grid.autosizeColumns();

or if you want to provide a fixed width and see it applied in the grid, then you can call或者如果你想提供一个固定的宽度并看到它应用在网格中,那么你可以调用

let shouldReRender = true;
grid.reRenderColumns(shouldReRender);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM