拖拽bug

This commit is contained in:
wanghaoo 2018-10-08 11:27:43 +08:00
parent 73e40dae1e
commit 85eaca8550
7 changed files with 39 additions and 17 deletions

View File

@ -14,7 +14,7 @@ const columns23 = [
title: "名字",
dataIndex: "a",
key: "a",
width: '10%'
width: '100'
},
{
title: "性别",

View File

@ -21,6 +21,7 @@ const columns = [
},
{
title: "Other",
width:600,
children: [
{
title: "Age",
@ -60,16 +61,19 @@ const columns = [
},
{
title: "Company",
width:400,
children: [
{
title: "Company Address",
dataIndex: "companyAddress",
key: "companyAddress"
key: "companyAddress",
width:200,
},
{
title: "Company Name",
dataIndex: "companyName",
key: "companyName"
key: "companyName",
width:200,
}
]
},
@ -104,7 +108,7 @@ class Demo3 extends Component {
columns={columns}
data={data}
bordered
scroll={{ x: "130%", y: 240 }}
scroll={{ y: 240 }}
/>
);
}

File diff suppressed because one or more lines are too long

27
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

@ -524,6 +524,7 @@ class Table extends Component {
getColGroup(columns, fixed) {
let cols = [];
let self= this;
let { contentWidthDiff = 0, lastShowIndex = 0 } = this.state;
if (this.props.expandIconAsCell && fixed !== 'right') {
cols.push(
@ -545,9 +546,15 @@ class Table extends Component {
}
cols = cols.concat(leafColumns.map((c, i, arr) => {
let width = c.width;
if (lastShowIndex == i) {
width = parseInt(width) + contentWidthDiff;
if(typeof(width)=='string' && width.indexOf('%')>-1){
width = parseInt(self.contentWidth * parseInt(width) /100);
}else{
width = parseInt(width);
}
if (lastShowIndex == i) {
width = width + contentWidthDiff;
}
return <col key={c.key} style={{ width: width, minWidth: c.width }} />;
}));
return <colgroup>{cols}</colgroup>;

View File

@ -110,7 +110,7 @@ class TableHeader extends Component {
this.contentTableWidth = parseInt(contentTableDom.scrollWidth)
}
const dragColWidth = this.drag.data[this.drag.currIndex].width;
if(typeof(dragColWidth)=='string' && dragColWidth.indexOf('%')){
if(typeof(dragColWidth)=='string' && dragColWidth.indexOf('%')>-1){
this.drag.width = this.contentTableWidth * parseInt(dragColWidth) /100
}else{
this.drag.width = parseInt(this.drag.data[this.drag.currIndex].width);