拖拽bug
This commit is contained in:
parent
73e40dae1e
commit
85eaca8550
|
@ -14,7 +14,7 @@ const columns23 = [
|
||||||
title: "名字",
|
title: "名字",
|
||||||
dataIndex: "a",
|
dataIndex: "a",
|
||||||
key: "a",
|
key: "a",
|
||||||
width: '10%'
|
width: '100'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "性别",
|
title: "性别",
|
||||||
|
|
|
@ -21,6 +21,7 @@ const columns = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Other",
|
title: "Other",
|
||||||
|
width:600,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: "Age",
|
title: "Age",
|
||||||
|
@ -60,16 +61,19 @@ const columns = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Company",
|
title: "Company",
|
||||||
|
width:400,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: "Company Address",
|
title: "Company Address",
|
||||||
dataIndex: "companyAddress",
|
dataIndex: "companyAddress",
|
||||||
key: "companyAddress"
|
key: "companyAddress",
|
||||||
|
width:200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Company Name",
|
title: "Company Name",
|
||||||
dataIndex: "companyName",
|
dataIndex: "companyName",
|
||||||
key: "companyName"
|
key: "companyName",
|
||||||
|
width:200,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -104,7 +108,7 @@ class Demo3 extends Component {
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={data}
|
data={data}
|
||||||
bordered
|
bordered
|
||||||
scroll={{ x: "130%", y: 240 }}
|
scroll={{ y: 240 }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
11
src/Table.js
11
src/Table.js
|
@ -524,6 +524,7 @@ class Table extends Component {
|
||||||
|
|
||||||
getColGroup(columns, fixed) {
|
getColGroup(columns, fixed) {
|
||||||
let cols = [];
|
let cols = [];
|
||||||
|
let self= this;
|
||||||
let { contentWidthDiff = 0, lastShowIndex = 0 } = this.state;
|
let { contentWidthDiff = 0, lastShowIndex = 0 } = this.state;
|
||||||
if (this.props.expandIconAsCell && fixed !== 'right') {
|
if (this.props.expandIconAsCell && fixed !== 'right') {
|
||||||
cols.push(
|
cols.push(
|
||||||
|
@ -545,9 +546,15 @@ class Table extends Component {
|
||||||
}
|
}
|
||||||
cols = cols.concat(leafColumns.map((c, i, arr) => {
|
cols = cols.concat(leafColumns.map((c, i, arr) => {
|
||||||
let width = c.width;
|
let width = c.width;
|
||||||
if (lastShowIndex == i) {
|
if(typeof(width)=='string' && width.indexOf('%')>-1){
|
||||||
width = parseInt(width) + contentWidthDiff;
|
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 <col key={c.key} style={{ width: width, minWidth: c.width }} />;
|
||||||
}));
|
}));
|
||||||
return <colgroup>{cols}</colgroup>;
|
return <colgroup>{cols}</colgroup>;
|
||||||
|
|
|
@ -110,7 +110,7 @@ class TableHeader extends Component {
|
||||||
this.contentTableWidth = parseInt(contentTableDom.scrollWidth)
|
this.contentTableWidth = parseInt(contentTableDom.scrollWidth)
|
||||||
}
|
}
|
||||||
const dragColWidth = this.drag.data[this.drag.currIndex].width;
|
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
|
this.drag.width = this.contentTableWidth * parseInt(dragColWidth) /100
|
||||||
}else{
|
}else{
|
||||||
this.drag.width = parseInt(this.drag.data[this.drag.currIndex].width);
|
this.drag.width = parseInt(this.drag.data[this.drag.currIndex].width);
|
||||||
|
|
Loading…
Reference in New Issue