BUG: Column sizing broken for column with '*' initWidth

This bug even exists in the DHTMLX example on the website.

See: Autowidth for colum(s)

Trying to resize the column whose init width has been set to ‘*’ does not work. If you try to size the column after it, it actually shrinks the column instead of widening it and vice-versa.

In the example on the website, the second column is broken because of the code below. Changing the initWidth to not use a ‘*’ results in correct resizing behavior.


Are there any known workarounds for this bug? Can this get fixed for the next release of DHTMLXGrid?


Unfortunately this is the expected behavior.
“Book Title” column will take all available space after resizing other columns. “Book Title” cannot be resized manually, as it take all available space.

Seems like a poor design that is inconsistent with every other grid control I’ve ever used.

The benefit in the ‘’ is for initialization so that manual column sizing calculations aren’t mandatory for the developer. Since it’s an “initialization width” setting, it doesn’t make sense to constantly re-apply the width at every resize event after. If you don’t want to change the behavior, then can there at least be a way to revert to the normal column resizing behavior after the grid has been initialized with a '’ initWidth?

Another easy option to meet normal expected behavior is for all columns to the right of the ‘*’ column to use the left vertical line instead of the right vertical line of the column to set the column size. The point of reference for resizing the column feels backwards.

You may set the widths of your columns in percentages of the container width using the setInitWidthsP() method:
docs.dhtmlx.com/doku.php?id=dhtm … nitwidthsp

Thank you for your recommendations. They will be considered.

The problem with setInitWidthsP is it still sets the width in pixels. Yes, it seems it’s a percentage of the pixel width of the entire table, but this seems misleading since the widths could effectively be set as a percentage as well. Since the column widths are still a fixed width, this removes any basic native responsiveness to changes to the width of the container after initialization. Sure, things could be managed manually with javascript events, but continually having to build manual “hacks” to solve basic design problems begins to erode the convenience of having such a tool in the first place.

SetInitWidthP doesn’t help. For example, if one column is for checkboxes, it’s a known width. I never want it any larger or smaller. Setting it to a percentage width will never accomplish this.

In the end, the useful feature here is to be able to define certain columns to a desired width (such as checkbox columns) and others to use a remainder width. However, the resize behavior of the GUI after this point is very unintuitive.

If it looks like a bug, acts like a bug, then it probably is a bug :laughing: