table固定列取高度有问题

This commit is contained in:
wanghaoo 2018-08-29 14:54:30 +08:00
parent 51c4d55d16
commit 35af8dd955
5 changed files with 51 additions and 369 deletions

View File

@ -471,8 +471,12 @@ var Table = function (_Component) {
if (this.columnManager.isAnyColumnsFixed()) {
onHoverProps.onHover = this.handleRowHover;
}
var height = fixed && fixedColumnsBodyRowsHeight[i] ? fixedColumnsBodyRowsHeight[i] : null;
var fixedIndex = i;
//判断是否是tree结构
if (this.treeType) {
fixedIndex = this.treeRowIndex;
}
var height = fixed && fixedColumnsBodyRowsHeight[fixedIndex] ? fixedColumnsBodyRowsHeight[fixedIndex] : null;
var leafColumns = void 0;
if (fixed === 'left') {
@ -491,7 +495,7 @@ var Table = function (_Component) {
record: record,
expandIconAsCell: expandIconAsCell,
onDestroy: this.onRowDestroy,
index: i,
index: fixedIndex,
visible: visible,
expandRowByClick: expandRowByClick,
onExpand: this.onExpanded,
@ -511,13 +515,14 @@ var Table = function (_Component) {
ref: rowRef,
store: this.store
})));
this.treeRowIndex++;
var subVisible = visible && isRowExpanded;
if (expandedRowContent && isRowExpanded) {
rst.push(this.getExpandedRow(key, expandedRowContent, subVisible, expandedRowClassName(record, i, indent), fixed));
}
if (childrenColumn) {
this.treeType = true; //证明是tree表形式
rst = rst.concat(this.getRowsByData(childrenColumn, subVisible, indent + 1, columns, fixed));
}
}
@ -525,6 +530,8 @@ var Table = function (_Component) {
};
Table.prototype.getRows = function getRows(columns, fixed) {
//统计index只有含有鼠表结构才有用因为数表结构时固定列的索引取值有问题
this.treeRowIndex = 0;
return this.getRowsByData(this.state.data, true, 0, columns, fixed);
};

File diff suppressed because one or more lines are too long

384
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

@ -373,9 +373,13 @@ class Table extends Component{
if (this.columnManager.isAnyColumnsFixed()) {
onHoverProps.onHover = this.handleRowHover;
}
const height = (fixed && fixedColumnsBodyRowsHeight[i]) ?
fixedColumnsBodyRowsHeight[i] : null;
let fixedIndex = i;
//判断是否是tree结构
if(this.treeType){
fixedIndex = this.treeRowIndex;
}
const height = (fixed && fixedColumnsBodyRowsHeight[fixedIndex]) ?
fixedColumnsBodyRowsHeight[fixedIndex] : null;
let leafColumns;
@ -397,7 +401,7 @@ class Table extends Component{
record={record}
expandIconAsCell={expandIconAsCell}
onDestroy={this.onRowDestroy}
index={i}
index={fixedIndex}
visible={visible}
expandRowByClick={expandRowByClick}
onExpand={this.onExpanded}
@ -418,7 +422,7 @@ class Table extends Component{
store={this.store}
/>
);
this.treeRowIndex++;
const subVisible = visible && isRowExpanded;
if (expandedRowContent && isRowExpanded) {
@ -427,6 +431,7 @@ class Table extends Component{
));
}
if (childrenColumn) {
this.treeType = true;//证明是tree表形式
rst = rst.concat(this.getRowsByData(
childrenColumn, subVisible, indent + 1, columns, fixed
));
@ -436,6 +441,8 @@ class Table extends Component{
}
getRows(columns, fixed) {
//统计index只有含有鼠表结构才有用因为数表结构时固定列的索引取值有问题
this.treeRowIndex = 0;
return this.getRowsByData(this.state.data, true, 0, columns, fixed);
}