拖拽bug
This commit is contained in:
parent
73e40dae1e
commit
85eaca8550
|
@ -14,7 +14,7 @@ const columns23 = [
|
|||
title: "名字",
|
||||
dataIndex: "a",
|
||||
key: "a",
|
||||
width: '10%'
|
||||
width: '100'
|
||||
},
|
||||
{
|
||||
title: "性别",
|
||||
|
|
|
@ -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
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) {
|
||||
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>;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue