v 1.6.0 交换列处理
This commit is contained in:
parent
3d8ef5860c
commit
8e379ae5e6
|
@ -75,7 +75,8 @@ var TableHeader = function (_Component) {
|
||||||
var currentCols = _this.table.cols[_this.drag.currIndex];
|
var currentCols = _this.table.cols[_this.drag.currIndex];
|
||||||
var diff = event.x - _this.drag.oldLeft;
|
var diff = event.x - _this.drag.oldLeft;
|
||||||
var newWidth = _this.drag.oldWidth + diff;
|
var newWidth = _this.drag.oldWidth + diff;
|
||||||
if (newWidth > _this.drag.minWidth) {
|
// if(newWidth > this.drag.minWidth){
|
||||||
|
if (newWidth > _this.minWidth) {
|
||||||
currentCols.style.width = newWidth + 'px';
|
currentCols.style.width = newWidth + 'px';
|
||||||
//hao 支持固定表头拖拽 修改表体的width
|
//hao 支持固定表头拖拽 修改表体的width
|
||||||
if (_this.fixedTable.cols) {
|
if (_this.fixedTable.cols) {
|
||||||
|
@ -174,6 +175,7 @@ var TableHeader = function (_Component) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var data = _this.getCurrentEventData(e);
|
var data = _this.getCurrentEventData(e);
|
||||||
|
if (!data) return;
|
||||||
if (!_this.currentObj || _this.currentObj.key == data.key) return;
|
if (!_this.currentObj || _this.currentObj.key == data.key) return;
|
||||||
if (!_this.props.onDrop) return;
|
if (!_this.props.onDrop) return;
|
||||||
_this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: data });
|
_this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: data });
|
||||||
|
@ -308,6 +310,7 @@ var TableHeader = function (_Component) {
|
||||||
width: 0,
|
width: 0,
|
||||||
option: ''
|
option: ''
|
||||||
};
|
};
|
||||||
|
_this.minWidth = 80; //确定最小宽度就是80
|
||||||
_this.table = null;
|
_this.table = null;
|
||||||
var _row = [];
|
var _row = [];
|
||||||
_this.props.rows[0] && _this.props.rows[0].forEach(function (item) {
|
_this.props.rows[0] && _this.props.rows[0].forEach(function (item) {
|
||||||
|
|
|
@ -12630,7 +12630,8 @@
|
||||||
var currentCols = _this.table.cols[_this.drag.currIndex];
|
var currentCols = _this.table.cols[_this.drag.currIndex];
|
||||||
var diff = event.x - _this.drag.oldLeft;
|
var diff = event.x - _this.drag.oldLeft;
|
||||||
var newWidth = _this.drag.oldWidth + diff;
|
var newWidth = _this.drag.oldWidth + diff;
|
||||||
if (newWidth > _this.drag.minWidth) {
|
// if(newWidth > this.drag.minWidth){
|
||||||
|
if (newWidth > _this.minWidth) {
|
||||||
currentCols.style.width = newWidth + 'px';
|
currentCols.style.width = newWidth + 'px';
|
||||||
//hao 支持固定表头拖拽 修改表体的width
|
//hao 支持固定表头拖拽 修改表体的width
|
||||||
if (_this.fixedTable.cols) {
|
if (_this.fixedTable.cols) {
|
||||||
|
@ -12729,6 +12730,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var data = _this.getCurrentEventData(e);
|
var data = _this.getCurrentEventData(e);
|
||||||
|
if (!data) return;
|
||||||
if (!_this.currentObj || _this.currentObj.key == data.key) return;
|
if (!_this.currentObj || _this.currentObj.key == data.key) return;
|
||||||
if (!_this.props.onDrop) return;
|
if (!_this.props.onDrop) return;
|
||||||
_this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: data });
|
_this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: data });
|
||||||
|
@ -12863,6 +12865,7 @@
|
||||||
width: 0,
|
width: 0,
|
||||||
option: ''
|
option: ''
|
||||||
};
|
};
|
||||||
|
_this.minWidth = 80; //确定最小宽度就是80
|
||||||
_this.table = null;
|
_this.table = null;
|
||||||
var _row = [];
|
var _row = [];
|
||||||
_this.props.rows[0] && _this.props.rows[0].forEach(function (item) {
|
_this.props.rows[0] && _this.props.rows[0].forEach(function (item) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -29,6 +29,7 @@ class TableHeader extends Component {
|
||||||
width: 0,
|
width: 0,
|
||||||
option:''
|
option:''
|
||||||
};
|
};
|
||||||
|
this.minWidth = 80;//确定最小宽度就是80
|
||||||
this.table = null;
|
this.table = null;
|
||||||
let _row = [];
|
let _row = [];
|
||||||
this.props.rows[0] &&
|
this.props.rows[0] &&
|
||||||
|
@ -164,7 +165,8 @@ class TableHeader extends Component {
|
||||||
let currentCols = this.table.cols[this.drag.currIndex];
|
let currentCols = this.table.cols[this.drag.currIndex];
|
||||||
let diff = (event.x - this.drag.oldLeft);
|
let diff = (event.x - this.drag.oldLeft);
|
||||||
let newWidth = this.drag.oldWidth + diff;
|
let newWidth = this.drag.oldWidth + diff;
|
||||||
if(newWidth > this.drag.minWidth){
|
// if(newWidth > this.drag.minWidth){
|
||||||
|
if(newWidth > this.minWidth){
|
||||||
currentCols.style.width = newWidth +'px';
|
currentCols.style.width = newWidth +'px';
|
||||||
//hao 支持固定表头拖拽 修改表体的width
|
//hao 支持固定表头拖拽 修改表体的width
|
||||||
if(this.fixedTable.cols){
|
if(this.fixedTable.cols){
|
||||||
|
@ -309,6 +311,7 @@ class TableHeader extends Component {
|
||||||
if (!this.props.draggable) return;
|
if (!this.props.draggable) return;
|
||||||
if(this.drag.option === 'border'){return;}
|
if(this.drag.option === 'border'){return;}
|
||||||
let data = this.getCurrentEventData(e);
|
let data = this.getCurrentEventData(e);
|
||||||
|
if(!data)return;
|
||||||
if (!this.currentObj || this.currentObj.key == data.key) return;
|
if (!this.currentObj || this.currentObj.key == data.key) return;
|
||||||
if(!this.props.onDrop)return;
|
if(!this.props.onDrop)return;
|
||||||
this.props.onDrop(event,{dragSource:this.currentObj,dragTarg:data});
|
this.props.onDrop(event,{dragSource:this.currentObj,dragTarg:data});
|
||||||
|
|
Loading…
Reference in New Issue