fix: 固定列在主表渲染引起的渲染多次问题
This commit is contained in:
parent
95637d9eac
commit
390a8a4e5f
File diff suppressed because one or more lines are too long
|
@ -452,8 +452,8 @@
|
|||
color: rgb(33, 33, 33);
|
||||
background-clip: padding-box;
|
||||
-webkit-user-select: none;
|
||||
/*
|
||||
Introduced in IE 10.
|
||||
/*
|
||||
Introduced in IE 10.
|
||||
*/
|
||||
-ms-user-select: none;
|
||||
user-select: none; }
|
||||
|
|
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
112
src/TableCell.js
112
src/TableCell.js
|
@ -199,66 +199,72 @@ class TableCell extends Component{
|
|||
let tdProps;
|
||||
let colSpan;
|
||||
let rowSpan,title;
|
||||
|
||||
if (render && !showSum) {
|
||||
text = render(text, record, index,{
|
||||
dataIndex, render, fieldType, linkConfig, fontColor, bgColor,...other
|
||||
});
|
||||
if (this.isInvalidRenderCellText(text)) {
|
||||
tdProps = text.props || {};
|
||||
rowSpan = (tdProps.rowSpan>lazyEndIndex && lazyEndIndex>5)?lazyEndIndex-index:tdProps.rowSpan;
|
||||
colSpan = tdProps.colSpan;
|
||||
text = text.children;
|
||||
}
|
||||
}
|
||||
|
||||
let colMenu = this.renderColumnMenu(column.cellMenu, text, record, index);
|
||||
// 根据 fieldType 来渲染数据
|
||||
if(!render){
|
||||
switch(column.fieldType){
|
||||
case 'link':{
|
||||
text = this.renderLinkType(text, record, index, column.linkConfig);
|
||||
break;
|
||||
// 如果是固定列在主表格上就渲染null
|
||||
if(column.fixed && !fixed){
|
||||
text = null
|
||||
}else {
|
||||
if (render && !showSum) {
|
||||
text = render(text, record, index,{
|
||||
dataIndex, render, fieldType, linkConfig, fontColor, bgColor,...other
|
||||
});
|
||||
if (this.isInvalidRenderCellText(text)) {
|
||||
tdProps = text.props || {};
|
||||
rowSpan = (tdProps.rowSpan>lazyEndIndex && lazyEndIndex>5)?lazyEndIndex-index:tdProps.rowSpan;
|
||||
colSpan = tdProps.colSpan;
|
||||
text = text.children;
|
||||
}
|
||||
case 'bool':{
|
||||
text = this.renderBoolType(text, column.boolConfig);
|
||||
break;
|
||||
}
|
||||
case 'currency':{
|
||||
let config = {
|
||||
precision: 2, // 精度值,需要大于0
|
||||
thousand: true, // 是否显示千分符号
|
||||
makeUp: true, // 末位是否补零
|
||||
preSymbol: '', // 前置符号
|
||||
nextSymbol: '', // 后置符号
|
||||
}
|
||||
|
||||
|
||||
// 根据 fieldType 来渲染数据
|
||||
if(!render){
|
||||
switch(column.fieldType){
|
||||
case 'link':{
|
||||
text = this.renderLinkType(text, record, index, column.linkConfig);
|
||||
break;
|
||||
}
|
||||
text = this.renderNumber(text, {...config,...column.currencyConfig}, column.width);
|
||||
break;
|
||||
}
|
||||
case 'number':{
|
||||
let config = {
|
||||
precision: 0, // 精度值,需要大于0
|
||||
thousand: true, // 是否显示千分符号
|
||||
makeUp: false, // 末位是否补零
|
||||
preSymbol: '', // 前置符号
|
||||
nextSymbol: '', // 后置符号
|
||||
case 'bool':{
|
||||
text = this.renderBoolType(text, column.boolConfig);
|
||||
break;
|
||||
}
|
||||
case 'currency':{
|
||||
let config = {
|
||||
precision: 2, // 精度值,需要大于0
|
||||
thousand: true, // 是否显示千分符号
|
||||
makeUp: true, // 末位是否补零
|
||||
preSymbol: '', // 前置符号
|
||||
nextSymbol: '', // 后置符号
|
||||
}
|
||||
text = this.renderNumber(text, {...config,...column.currencyConfig}, column.width);
|
||||
break;
|
||||
}
|
||||
case 'number':{
|
||||
let config = {
|
||||
precision: 0, // 精度值,需要大于0
|
||||
thousand: true, // 是否显示千分符号
|
||||
makeUp: false, // 末位是否补零
|
||||
preSymbol: '', // 前置符号
|
||||
nextSymbol: '', // 后置符号
|
||||
}
|
||||
text = this.renderNumber(text, {...config,...column.numberConfig}, column.width);
|
||||
break;
|
||||
}
|
||||
case 'date':{
|
||||
text = this.renderDate(text, column.dateConfig);
|
||||
break;
|
||||
}
|
||||
case 'select':{
|
||||
text = this.renderSelect(text, column.selectConfig);
|
||||
break;
|
||||
}
|
||||
default : {
|
||||
break;
|
||||
}
|
||||
text = this.renderNumber(text, {...config,...column.numberConfig}, column.width);
|
||||
break;
|
||||
}
|
||||
case 'date':{
|
||||
text = this.renderDate(text, column.dateConfig);
|
||||
break;
|
||||
}
|
||||
case 'select':{
|
||||
text = this.renderSelect(text, column.selectConfig);
|
||||
break;
|
||||
}
|
||||
default : {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.isInvalidRenderCellText(text)) {
|
||||
text = null;
|
||||
|
|
Loading…
Reference in New Issue