简体   繁体   中英

Slickgrid: Make newly added columns same width as others

I have a Slickgrid with multiple columns. 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() .

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.

How can I set the newly added column's width equal to the other's width?

Edit: My Version is 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)

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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