/*
Product Name: dhtmlxSuite
Version: 4.0.3
Edition: Professional
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
Copyright UAB Dinamenta http://www.dhtmlx.com
*/
/**
* @desc: enable/disable drag-and-drop
* @type: public
* @param: mode - enabled/disabled [ can be true/false/temporary_disabled - last value mean that tree can be D-n-D can be switched to true later ]
* @topic: 0
*/
dhtmlXGridObject.prototype.enableDragAndDrop=function(mode){
if (mode=="temporary_disabled"){
this.dADTempOff=false;
mode=true; }
else
this.dADTempOff=true;
this.dragAndDropOff=convertStringToBoolean(mode);
this._drag_validate=true;
if (mode)
this.objBox.ondragstart = function (e) {
(e||event).cancelBubble = true;
return false;
}
};
/**
* @desc: set Drag-And-Drop behavior (child - drop as chils, sibling - drop as sibling
* @type: public
* @param: mode - behavior name (child,sibling,complex)
* @topic: 0
*/
dhtmlXGridObject.prototype.setDragBehavior=function(mode){
this.dadmodec=this.dadmodefix=0;
switch (mode) {
case "child": this.dadmode=0; this._sbmod=false; break;
case "sibling": this.dadmode=1; this._sbmod=false; break;
case "sibling-next": this.dadmode=1; this._sbmod=true; break;
case "complex": this.dadmode=2; this._sbmod=false; break;
case "complex-next": this.dadmode=2; this._sbmod=true; break;
} };
/**
* @desc: switch to mode when draged item, droped in target location in same order as they was in source grid
* @type: public
* @param: mode - true/false to enable/disable mode
* @topic: 0
*/
dhtmlXGridObject.prototype.enableDragOrder=function(mode){
this._dndorder=convertStringToBoolean(mode);
};
dhtmlXGridObject.prototype._checkParent=function(row,ids){
var z=this._h2.get[row.idd].parent;
if (!z.parent) return;
for (var i=0; i=0; i--)
if (this._checkParent(this.rowsAr[z[i]],z)) z.splice(i,1);
}
var self=this;
if (z.length && this._dndorder)
z.sort(function(a,b){ return (self.rowsAr[a].rowIndex>self.rowsAr[b].rowIndex?1:-1); });
var el = this.getFirstParentOfType(_isIE?e.srcElement:e.target,"TD");
if (el) this._dndExtra=el._cellIndex;
this._dragged=new Array();
for (var i=0; i=0 && this.tobj._h2.get[this.tobj.rowsBuffer[ind].idd].state=="minus")?this.tobj._getOpenLenght(this.tobj.rowsBuffer[ind].idd,0):0));
}
/**
* @desc: get row related image
* @type: private
*/
dragContext.prototype.img=function(){
if ((this.target!="grid")&&(this.sobj._h2))
return this.sobj.getItemImage(this.sid);
else return null;
}
/**
* @desc: return list of rows in context
* @type: private
*/
dragContext.prototype.slist=function(){
var res=new Array();
for (var i=0; i(parseInt(this.objBox.offsetHeight)-50) )
this.objBox.scrollTop=parseInt(this.objBox.scrollTop)+20;
//scroll top
if ( (a1-a2+parseInt(this.objBox.scrollTop))<(parseInt(this.objBox.scrollTop)+30) )
this.objBox.scrollTop=parseInt(this.objBox.scrollTop)-20;
if (skip) return 0;
if (this.dadmode==2)
{
var z=y-a1+(document.body.scrollTop||document.documentElement.scrollTop)-2-htmlObject.offsetHeight/2;
if ((Math.abs(z)-htmlObject.offsetHeight/6)>0)
{
this.dadmodec=1;
//sibbling zone
if (z<0) this.dadmodefix=-1; else this.dadmodefix=1;
}
else this.dadmodec=0;
}
else
this.dadmodec=this.dadmode;
if (this.dadmodec){
if (!this._sdrgc) this._createSdrgc();
this._sdrgc.style.display="block";
this._sdrgc.style.top=a1-a2+parseInt(this.objBox.scrollTop)+((this.dadmodefix>=0)?htmlObject.offsetHeight:0)+"px";
}
else{
this._llSelD=htmlObject;
if (htmlObject.parentNode.tagName=="TR")
for (var i=0; i