Happy-Coding-Clans / vue-easytable

A powerful data table based on vuejs. You can use it as data grid、Microsoft Excel or Google sheets. It supports virtual scroll、cell edit etc.
https://happy-coding-clans.github.io/vue-easytable/
MIT License
3.69k stars 738 forks source link

[Feature Request] Add support for horizontal column resize #361

Closed janoseross closed 1 year ago

janoseross commented 3 years ago

I am opening an issue for

vue-easytable

Issue Type

Feature

Issue Title

Add support for horizontal column resize

What problem does this feature solve?

I have a table with a lot of columns. I already use fixed columns as well (with horizontal scrollbar) and ellipsis to avoid line-break. Even with these features sometimes would be handy to resize a specific column (change the width of it) by dragging it. For example: I have a column called 'name'. The names are usually formed from 10 to 15 characters. In a specific case this name can be much longer, like 30-50 characters. The default width of the column is adjusted to the majority of the data, not to the exceptions/unique values, it's not a solution to just add a higher value to it.

What does the proposed API look like?

<ve-table :horizontal-resizable="true" \/>

accuPaul commented 2 years ago

I have a work-around for this. Create a custom style for the header, like

.resize-columns {
  resize: horizontal;
  overflow: auto;
}

And then have the headerCellClass return that.

cellStyleOption: {
                    headerCellClass: ({row, column}) => {
                      return "resize-columns"
                    },
               },
huangshuwei commented 1 year ago

The new version supports manual column width adjustment: https://github.com/Happy-Coding-Clans/vue-easytable/releases/tag/v2.21.0