TableHeader中key值设定
This commit is contained in:
parent
3bcbdcfa42
commit
f967964d98
|
@ -592,7 +592,7 @@ var TableHeader = function (_Component) {
|
|||
if (!da.fixed) {
|
||||
return _react2["default"].createElement(
|
||||
"th",
|
||||
{ key: Math.random() + new Date().getTime(), className: thClassName, "data-th-fixed": da.fixed,
|
||||
{ key: da.dataindex, className: thClassName, "data-th-fixed": da.fixed,
|
||||
"data-line-key": da.key, "data-line-index": columIndex, "data-th-width": da.width },
|
||||
da.children,
|
||||
dragborder ? _react2["default"].createElement(
|
||||
|
|
|
@ -72,35 +72,11 @@ function dragColumn(Table) {
|
|||
columns[index] = dragSourceColum;
|
||||
}
|
||||
}
|
||||
// let titles = [];
|
||||
// columns.forEach(da=>{
|
||||
// for(let attr of da){
|
||||
|
||||
// }
|
||||
// if(typeof da.title != "string"){
|
||||
// titles.push(da.title);
|
||||
// delete da.title;
|
||||
// }
|
||||
// });
|
||||
// let newColumns = null;
|
||||
// if(titles.length != 0){
|
||||
// newColumns = JSON.parse(JSON.stringify(columns));
|
||||
// for (let index = 0; index < newColumns.length; index++) {
|
||||
// newColumns[index].title = titles[index];
|
||||
// }
|
||||
// console.log("----columns----",newColumns);
|
||||
// }else{
|
||||
// newColumns = JSON.parse(JSON.stringify(columns));
|
||||
// }
|
||||
// this.setState({
|
||||
// columns:newColumns
|
||||
// });
|
||||
|
||||
_this.setState({
|
||||
columns: cloneDeep(columns)
|
||||
});
|
||||
if (_this.props.dragDrop) {
|
||||
_this.props.dragDrop(event, data, newColumns);
|
||||
if (_this.props.onDrop) {
|
||||
_this.props.onDrop(event, data, columns);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -143,21 +143,31 @@ function multiSelect(Table, Checkbox) {
|
|||
if (checkedAll) {
|
||||
check = false;
|
||||
} else {
|
||||
if (indeterminate) {
|
||||
check = true;
|
||||
} else {
|
||||
check = true;
|
||||
}
|
||||
// if(indeterminate){
|
||||
// check = true;
|
||||
// }else{
|
||||
// check = true;
|
||||
// }
|
||||
check = true;
|
||||
}
|
||||
var selectList = [];
|
||||
|
||||
data.forEach(function (item) {
|
||||
item._checked = check;
|
||||
if (!item._disabled) {
|
||||
item._checked = check;
|
||||
}
|
||||
|
||||
if (item._checked) {
|
||||
selectList.push(item);
|
||||
}
|
||||
});
|
||||
if (selectList.length > 0) {
|
||||
indeterminate = true;
|
||||
} else {
|
||||
indeterminate = false;
|
||||
}
|
||||
_this2.setState({
|
||||
indeterminate: false,
|
||||
indeterminate: indeterminate,
|
||||
checkedAll: check
|
||||
});
|
||||
_this2.props.getSelectedDataFunc(selectList);
|
||||
|
@ -190,11 +200,22 @@ function multiSelect(Table, Checkbox) {
|
|||
indeterminate = _state2.indeterminate;
|
||||
|
||||
var checkAttr = { checked: checkedAll ? true : false };
|
||||
var data = _this2.props.data;
|
||||
var dataLength = data.length;
|
||||
var disabledCount = 0;
|
||||
indeterminate ? checkAttr.indeterminate = true : "";
|
||||
//设置表头Checkbox是否可以点击
|
||||
data.forEach(function (item, index, arr) {
|
||||
if (item._disabled) {
|
||||
disabledCount++;
|
||||
}
|
||||
});
|
||||
|
||||
var _defaultColumns = [{
|
||||
title: _react2["default"].createElement(Checkbox, _extends({
|
||||
className: 'table-checkbox'
|
||||
}, checkAttr, {
|
||||
disabled: disabledCount == dataLength ? true : false,
|
||||
onChange: _this2.onAllCheckChange
|
||||
})),
|
||||
key: "checkbox",
|
||||
|
|
|
@ -536,7 +536,7 @@ class TableHeader extends Component {
|
|||
}
|
||||
thClassName += `${fixedStyle}`;
|
||||
if(!da.fixed){
|
||||
return (<th key={Math.random()+new Date().getTime()} className={thClassName} data-th-fixed={da.fixed}
|
||||
return (<th key={da.dataindex} className={thClassName} data-th-fixed={da.fixed}
|
||||
data-line-key={da.key} data-line-index={columIndex} data-th-width={da.width} >
|
||||
{da.children}
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue