Skip to content

Commit abe3193

Browse files
authored
Merge pull request #541 from micheldpcarlos/feature/optional-column-resize
[Feature] Optional column resize disabling (disableResizing)
2 parents df1128c + 5114609 commit abe3193

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

examples/src/docs/en/ve-table/api/db.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,14 @@ export const db = {
395395
default: "-",
396396
rowKey: 45,
397397
},
398+
{
399+
param: "disableResizing",
400+
desc: `Disable resizing for this column. Only effective if <code>columnWidthResizeOption</code> is enabled`,
401+
type: `<code>Boolean</code>`,
402+
optionalVal: "-",
403+
default: "false",
404+
rowKey: 46,
405+
},
398406
{
399407
param: "<span class='expand'>ellipsis</span>",
400408
desc: `Cell ellipsis option`,

examples/src/docs/en/ve-table/column-resize/basic.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
You can hover the mouse between two columns and drag.If the column width is not set, the default is 50px
44

5-
:::demo 1、Set the min width of resize column through `columnMinWidth`<br>2、Get the callback method of resize column changes through `sizeChange({ column, differWidth, columnWidth })`
5+
:::demo 1、Set the min width of resize column through `columnMinWidth`<br>2、Get the callback method of resize column changes through `sizeChange({ column, differWidth, columnWidth })`<br>3、Cols 6, 7, and 8 resizing is disabled through `disableResizing`
66

77
```html
88
<template>
@@ -59,9 +59,15 @@ You can hover the mouse between two columns and drag.If the column width is not
5959
{ field: "col3", key: "col3", title: "Col3", width: 220 },
6060
{ field: "col4", key: "col4", title: "Col4", width: 220 },
6161
{ field: "col5", key: "col5", title: "Col5", width: 220 },
62-
{ field: "col6", key: "col6", title: "Col6", width: 220 },
63-
{ field: "col7", key: "col7", title: "Col7" },
64-
{ field: "col8", key: "col8", title: "Col8" },
62+
{
63+
field: "col6",
64+
key: "col6",
65+
title: "Col6",
66+
width: 220,
67+
disableResizing: true,
68+
},
69+
{ field: "col7", key: "col7", title: "Col7", disableResizing: true },
70+
{ field: "col8", key: "col8", title: "Col8", disableResizing: true },
6571
],
6672
columnResizeInfo: {
6773
column: "",

packages/ve-table/src/column-resizer/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export default {
8989
this.hooks.addHook(
9090
HOOKS_NAME.HEADER_CELL_MOUSEMOVE,
9191
({ event, column }) => {
92+
if (column.disableResizing) return;
9293
this.initColumnResizerPosition({ event, column });
9394
},
9495
);

0 commit comments

Comments
 (0)