拖拽回调函数时机修改

This commit is contained in:
wanghaoo 2018-12-05 12:39:29 +08:00
parent f2c99f0cc7
commit 5d98bced94
2 changed files with 10 additions and 10 deletions

View File

@ -127,10 +127,7 @@ var TableHeader = function (_Component) {
};
_this.onLineMouseUp = function (event) {
var rows = _this.props.rows;
var data = { rows: rows[0], cols: _this.table.cols, currIndex: _this.drag.currIndex };
_this.props.afterDragColWidth && _this.props.afterDragColWidth(data);
_this.clearDragBorder(event);
};
@ -446,7 +443,11 @@ var TableHeader = function (_Component) {
TableHeader.prototype.clearDragBorder = function clearDragBorder() {
// if (!this.props.dragborder || !this.props.draggable) return;
if (!this.drag) return;
if (!this.drag || !this.drag.option) return;
var rows = this.props.rows;
var data = { rows: rows[0], cols: this.table.cols, currIndex: this.drag.currIndex };
this.props.afterDragColWidth && this.props.afterDragColWidth(data);
this.drag = {
option: ""
};

View File

@ -210,9 +210,7 @@ class TableHeader extends Component {
};
onLineMouseUp = (event) => {
let {rows} = this.props;
let data = {rows:rows[0],cols:this.table.cols,currIndex:this.drag.currIndex};
this.props.afterDragColWidth && this.props.afterDragColWidth(data);
this.clearDragBorder(event);
};
bodyonLineMouseMove = (event) => {
@ -221,7 +219,10 @@ class TableHeader extends Component {
clearDragBorder(){
// if (!this.props.dragborder || !this.props.draggable) return;
if(!this.drag)return;
if(!this.drag || !this.drag.option)return;
let {rows} = this.props;
let data = {rows:rows[0],cols:this.table.cols,currIndex:this.drag.currIndex};
this.props.afterDragColWidth && this.props.afterDragColWidth(data);
this.drag = {
option:""
};
@ -281,7 +282,6 @@ class TableHeader extends Component {
let event = Event.getEvent(e);
if (!this.props.draggable) return;
if(this.drag.option === 'border'){return;}
console.log(this.drag.option+' -------onDragStart----------',event.target);
let th = this.getThDome(event.target);
if(!th)return;
let currentIndex = parseInt(th.getAttribute("data-line-index"));
@ -318,7 +318,6 @@ class TableHeader extends Component {
this.currentDome.setAttribute('draggable',false);//添加交换列效果
let data = this.getCurrentEventData(e);
if(!data)return;
console.log(this.drag.option+' -------onDrop----------',event.target);
if (!this.currentObj || this.currentObj.key == data.key) return;
if(!this.props.onDrop)return;
this.props.onDrop(event,{dragSource:this.currentObj,dragTarg:data});