Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mly-table-1229' into v1-develop
Browse files Browse the repository at this point in the history
liyuan-meng committed Jan 2, 2024

Verified

This commit was signed with the committer’s verified signature.
d2iq-dispatch D2iQ Dispatch
2 parents 45da94a + 61ad028 commit b1b7a89
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/c-table/demos/goods-table.md
Original file line number Diff line number Diff line change
@@ -339,6 +339,10 @@ class CTableDemo extends Component {
resolve({ totals: data.length, data: res });
})
}}
onColumnChange={({ columnData }) => {
console.log('column changed')
console.table(columnData);
}}
/>
</div>
);
1 change: 1 addition & 0 deletions src/components/c-table/index.md
Original file line number Diff line number Diff line change
@@ -117,6 +117,7 @@ this.tableRef.current.setColumn(columnData, isReloadGrid?);
| defaultShowColumns | 默认展示的列 | Array | [] | |
| disabledConfigColumns | 不可进行编辑的列 | Array | [] | |
| hideConfigColumns | 不展示在编辑区域的列 | Array | [] | |
| onColumnChange | 改变列后的回调函数 | function | - | |

### CTable 自定义模板配置
| 属性 | 说明 | 类型 | 默认值
3 changes: 2 additions & 1 deletion src/components/c-table/js/column.js
Original file line number Diff line number Diff line change
@@ -309,7 +309,7 @@ export default class Column {
renderConfig = () => {
const { _this } = this;
const { originColumnData } = _this.state;
const { disabled, disabledConfigColumns, hideConfigColumns } = _this.props;
const { disabled, disabledConfigColumns, hideConfigColumns, onColumnChange } = _this.props;
return (
<ul className={`${tablePrefixCls}-tooltip-content`}>
{originColumnData.filter(c => !hideConfigColumns.includes(c.dataIndex)).map((item) => (
@@ -327,6 +327,7 @@ export default class Column {
if (_this.props.supportMemory) {
setConfig(_this.state.originColumnData, _this.props.tableId);
}
onColumnChange({ columnData: { ..._this.state.originColumnData } });
this.setColumnData();
_this.setHeaderStyle();
_this.setFixedStyle();
2 changes: 2 additions & 0 deletions src/components/c-table/js/propType.js
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ export const propTypes = {
sortWidthOriginStatus: PropTypes.bool,
sortMultiColumns: PropTypes.bool,
showCheckedAll: PropTypes.bool,
onColumnChange: PropTypes.func,
};

export const defaultProps = {
@@ -151,4 +152,5 @@ export const defaultProps = {
sortWidthOriginStatus: false,
sortMultiColumns: false,
showCheckedAll: true,
onColumnChange: () => {},
};

0 comments on commit b1b7a89

Please sign in to comment.