This commit is contained in:
wanghaoo 2018-11-27 14:32:30 +08:00
parent 5698aff389
commit 18e161ddc9
6 changed files with 41 additions and 30 deletions

View File

@ -57,6 +57,7 @@ class Demo22 extends Component {
render() {
return <DragColumnTable columns={columns22} data={data22} bordered
draggable={true}
/>;
}

File diff suppressed because one or more lines are too long

38
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -341,23 +341,33 @@ class Table extends Component {
}
getHeaderRows(columns, currentRow = 0, rows) {
let { contentWidthDiff = 0, lastShowIndex = 0 } = this.state;
let filterCol = [];
rows = rows || [];
rows[currentRow] = rows[currentRow] || [];
columns.forEach(column => {
columns.forEach((column,i) => {
if (column.rowSpan && rows.length < column.rowSpan) {
while (rows.length < column.rowSpan) {
rows.push([]);
}
}
let width = column.width;
if (typeof (width) == 'string' && width.indexOf('%') > -1 && this.contentWidth) {
width = parseInt(this.contentWidth * parseInt(width) / 100);
} else if (width) {
width = parseInt(width);
}
if (lastShowIndex == i && width) {
width = width + contentWidthDiff;
}
const cell = {
key: column.key,
className: column.className || '',
children: column.title,
drgHover: column.drgHover,
fixed: column.fixed,
width: column.width,
width: width,
dataindex:column.dataIndex
};
if (column.onHeadCellClick) {

View File

@ -400,6 +400,7 @@ class TableHeader extends Component {
}
};
render() {
const {dragAbleOrBord,dragAbleOrBordStart} = this.state;
const {
@ -438,19 +439,8 @@ class TableHeader extends Component {
if (!fixed && da.fixed) {
fixedStyle = `${clsPrefix}-row-fixed-columns-in-body`;
}
if (
typeof da.width == "string" &&
da.width.indexOf("%") > -1 &&
this.props.contentWidth
) {
da.width = parseInt(
(this.props.contentWidth * parseInt(da.width)) / 100
);
} else if (da.width) {
da.width = parseInt(da.width);
}
if (lastShowIndex == i) {
da.width = parseInt(da.width) + contentWidthDiff;
canDotDrag = "th-can-not-drag";
}
if (filterable && index == rows.length - 1) {