//v.3.5 build 120731 /* Copyright DHTMLX LTD. http://www.dhtmlx.com You allowed to use this component or parts of it under GPL terms To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com */ var globalActiveDHTMLGridObject;String.prototype._dhx_trim=function(){return this.replace(/ /g," ").replace(/(^[ \t]*)|([ \t]*$)/g,"")};function dhtmlxArray(a){return dhtmlXHeir(a||[],dhtmlxArray._master)} dhtmlxArray._master={_dhx_find:function(a){for(var b=0;b=a;c--)this[c]=this[c-1];this[a]=b},_dhx_removeAt:function(a){this.splice(a,1)},_dhx_swapItems:function(a,b){var c=this[a];this[a]=this[b];this[b]=c}}; function dhtmlXGridObject(a){if(_isIE)try{document.execCommand("BackgroundImageCache",!1,!0)}catch(b){}if(a)if(typeof a=="object"){if(this.entBox=a,!this.entBox.id)this.entBox.id="cgrid2_"+this.uid()}else this.entBox=document.getElementById(a);else this.entBox=document.createElement("DIV"),this.entBox.id="cgrid2_"+this.uid();this.entBox.innerHTML="";dhtmlxEventable(this);var c=this;this._wcorr=0;this.fontWidth=7;this.row=this.cell=null;this.iconURL="";this.editor=null;this._dclE=this._f2kE=!0;this.combos= [];this.defVal=[];this.rowsAr={};this.rowsBuffer=dhtmlxArray();this.rowsCol=dhtmlxArray();this._data_cache={};this._ecache={};this._ud_enabled=!0;this.xmlLoader=new dtmlXMLLoaderObject(this.doLoadDetails,this,!0,this.no_cashe);this._maskArr=[];this.selectedRows=dhtmlxArray();this.UserData={};this._sizeFix=this._borderFix=0;this.entBox.className+=" gridbox";this.entBox.style.width=this.entBox.getAttribute("width")||(window.getComputedStyle?this.entBox.style.width||window.getComputedStyle(this.entBox, null).width:this.entBox.currentStyle?this.entBox.currentStyle.width:this.entBox.style.width||0)||"100%";this.entBox.style.height=this.entBox.getAttribute("height")||(window.getComputedStyle?this.entBox.style.height||window.getComputedStyle(this.entBox,null).height:this.entBox.currentStyle?this.entBox.currentStyle.height:this.entBox.style.height||0)||"100%";this.entBox.style.cursor="default";this.entBox.onselectstart=function(){return!1};var d=function(e){var a=document.createElement("TABLE");a.cellSpacing= a.cellPadding=0;a.style.cssText="width:100%;table-layout:fixed;";a.className=e.substr(2);return a};this.obj=d("c_obj");this.hdr=d("c_hdr");this.hdr.style.marginRight="20px";this.hdr.style.paddingRight="20px";this.objBox=document.createElement("DIV");this.objBox.style.width="100%";this.objBox.style.overflow="auto";this.objBox.appendChild(this.obj);this.objBox.className="objbox";this.hdrBox=document.createElement("DIV");this.hdrBox.style.width="100%";this.hdrBox.style.height="25px";this.hdrBox.style.overflow= "hidden";this.hdrBox.className="xhdr";this.preloadImagesAr=[];this.sortImg=document.createElement("IMG");this.sortImg.style.display="none";this.hdrBox.appendChild(this.sortImg);this.hdrBox.appendChild(this.hdr);this.hdrBox.style.position="relative";this.entBox.appendChild(this.hdrBox);this.entBox.appendChild(this.objBox);this.entBox.grid=this;this.objBox.grid=this;this.hdrBox.grid=this;this.obj.grid=this;this.hdr.grid=this;this.cellWidthPX=[];this.cellWidthPC=[];this.cellWidthType=this.entBox.cellwidthtype|| "px";this.delim=this.entBox.delimiter||",";this._csvDelim=",";this.hdrLabels=[];this.columnIds=[];this.columnColor=[];this._hrrar=[];this.cellType=dhtmlxArray();this.cellAlign=[];this.initCellWidth=[];this.fldSort=[];this._srdh=_isIE&&document.compatMode!="BackCompat"?22:20;this.imgURL=window.dhx_globalImgPath||"";this.isActive=!1;this.isEditable=!0;this.pagingOn=this.useImagesInHeader=!1;this.rowsBufferOutSize=0;dhtmlxEvent(window,"unload",function(){try{c.destructor&&c.destructor()}catch(e){}}); this.setSkin=function(e){this.skin_name=e;var a=this.entBox.className.split(" gridbox")[0];this.entBox.className=a+" gridbox gridbox_"+e;this.skin_h_correction=0;this.enableAlterCss("ev_"+e,"odd_"+e,this.isTreeGrid());this._fixAlterCss();switch(e){case "clear":this._topMb=document.createElement("DIV");this._topMb.className="topMumba";this._topMb.innerHTML="";this.entBox.appendChild(this._topMb); this._botMb=document.createElement("DIV");this._botMb.className="bottomMumba";this._botMb.innerHTML="";this.entBox.appendChild(this._botMb);if(this.entBox.style.position!="absolute")this.entBox.style.position="relative";this.skin_h_correction=20;break;case "white":this._srdh=40;this.forceDivInHeader=!0;break;case "dhx_skyblue":case "dhx_web":case "glassy_blue":case "dhx_black":case "dhx_blue":case "modern":case "light":this._srdh= 20;this.forceDivInHeader=!0;break;case "xp":this.forceDivInHeader=!0;this._srdh=_isIE&&document.compatMode!="BackCompat"?26:22;break;case "mt":this._srdh=_isIE&&document.compatMode!="BackCompat"?26:22;break;case "gray":if(_isIE&&document.compatMode!="BackCompat")this._srdh=22}if(_isIE&&this.hdr){var b=this.hdr.parentNode;b.removeChild(this.hdr);b.appendChild(this.hdr)}this.setSizes()};_isIE&&this.preventIECaching(!0);if(window.dhtmlDragAndDropObject)this.dragger=new dhtmlDragAndDropObject;this._doOnScroll= function(e,a){this.callEvent("onScroll",[this.objBox.scrollLeft,this.objBox.scrollTop]);this.doOnScroll(e,a)};this.doOnScroll=function(e,a){this.hdrBox.scrollLeft=this.objBox.scrollLeft;if(this.ftr)this.ftr.parentNode.scrollLeft=this.objBox.scrollLeft;if(!a&&this._srnd)this._dLoadTimer&&window.clearTimeout(this._dLoadTimer),this._dLoadTimer=window.setTimeout(function(){c._update_srnd_view&&c._update_srnd_view()},100)};this.attachToObject=function(e){e.appendChild(this.globalBox?this.globalBox:this.entBox); this.setSizes()};this.init=function(e){if(this.isTreeGrid()&&!this._h2){this._h2=new dhtmlxHierarchy;if(this._fake&&!this._realfake)this._fake._h2=this._h2;this._tgc={imgURL:null}}if(this._hstyles){this.editStop();this.fldSorted=this.r_fldSorted=this.resized=this.lastClicked=null;this.cellWidthPX=[];this.cellWidthPC=[];this.hdr.rows.length>0&&this.clearAll(!0);for(var a=this.hdr.insertRow(0),b=0;b0.5&&(h++,c--);var l=this.cellWidthPX[d]=Math.floor(h),c=c+h-l}else typeof this.cellWidthPX[d]=="undefined"&&(this.cellWidthPX[d]=this.initCellWidth[d]);this._hrrar[d]||(a+=this.cellWidthPX[d]*1)}if(b.length){var k=Math.floor((e- a)/b.length);k<0&&(k=1);for(d=0;da){var n=b[b.length-1];this.cellWidthPX[n]+=e-a;a=e}this._setAutoResize()}this.obj.style.width=a+"px";this.hdr.style.width=a+"px";if(this.ftr)this.ftr.style.width=a+"px";this.chngCellWidth();return a};this.setSizes=function(){if(this.hdr.rows[0]){var e=this.quirks=_isIE&&document.compatMode=="BackCompat",a=(this.entBox.offsetWidth-this.entBox.clientWidth)/2;if(!this.dontSetSizes)if(this.globalBox){var b= (this.globalBox.offsetWidth-this.globalBox.clientWidth)/2;if(this._delta_x&&!this._realfake){var f=this.globalBox.clientWidth;this.globalBox.style.width=this._delta_x;this.entBox.style.width=Math.max(0,this.globalBox.clientWidth+(e?b*2:0)-this._fake.entBox.clientWidth)+"px";f!=this.globalBox.clientWidth&&this._fake._correctSplit(this._fake.entBox.clientWidth)}if(this._delta_y&&!this._realfake)this.globalBox.style.height=this._delta_y,this.entBox.style.overflow=this._fake.entBox.style.overflow="hidden", this.entBox.style.height=this._fake.entBox.style.height=this.globalBox.clientHeight+(e?b*2:0)+"px"}else{if(this._delta_x)this.entBox.parentNode&&this.entBox.parentNode.tagName=="TD"?(this.entBox.style.width="1px",this.entBox.style.width=parseInt(this._delta_x)*this.entBox.parentNode.clientWidth/100-a*2+"px"):this.entBox.style.width=this._delta_x;if(this._delta_y)this.entBox.style.height=this._delta_y}window.clearTimeout(this._sizeTime);if(!this.entBox.offsetWidth&&(!this.globalBox||!this.globalBox.offsetWidth))this._sizeTime= window.setTimeout(function(){c.setSizes&&c.setSizes()},250);else{var d=!this._wthB&&(this.entBox.cmp||this._delta_x)&&(this.skin_name||"").indexOf("dhx")==0&&!e?2:0,h=!this._wthB&&(this.entBox.cmp||this._delta_y)&&(this.skin_name||"").indexOf("dhx")==0&&!e?2:0,l=this.parentGrid?!1:this.objBox.scrollHeight>this.objBox.offsetHeight,k=_isFF?18:18,m=this.entBox.clientWidth-(this.skin_h_correction||0)*(e?0:1)-d,n=this.entBox.clientWidth-(this.skin_h_correction||0)-d,o=this.entBox.clientHeight-h,p=this.setColumnSizes(n- (l?k:0)-(this._correction_x||0)),r=this.parentGrid?!1:this.objBox.scrollWidth>this.objBox.offsetWidth||this.objBox.style.overflowX=="scroll",s=this.hdr.clientHeight,t=this.ftr?this.ftr.clientHeight:0,u=m,q=o-s-t;this._awdth&&this._awdth[0]&&this._awdth[1]==99999&&(r=0);if(this._ahgr&&(q=this._ahgrMA?this.entBox.parentNode.clientHeight-s-t:this.obj.offsetHeight+(r?k:0)+(this._correction_y||0),this._ahgrM&&(q=this._ahgrF?Math.min(this._ahgrM,q+s+t)-s-t:Math.min(this._ahgrM,q)),l&&q>=this.obj.scrollHeight+ (r?k:0)))l=!1,this.setColumnSizes(n-(this._correction_x||0));if(this._awdth&&this._awdth[0]){if(this.cellWidthType=="%")this.cellWidthType="px";this._fake&&(p+=this._fake.entBox.clientWidth);u=Math.min(Math.max(p+(l?k:0),this._awdth[2]),this._awdth[1])+(this._correction_x||0);this._fake&&(u-=this._fake.entBox.clientWidth)}q=Math.max(0,q);this._ff_size_delta=this._ff_size_delta==0.1?0.2:0.1;if(!_isFF)this._ff_size_delta=0;if(!this.dontSetSizes)this.entBox.style.width=Math.max(0,u+(e?2:0)*a+this._ff_size_delta)+ "px",this.entBox.style.height=q+(e?2:0)*a+s+t+"px";this.objBox.style.height=q+(e&&!l?2:0)*a+"px";this.hdrBox.style.height=s+"px";q!=o&&this.doOnScroll(0,!this._srnd);var v=this["setSizes_"+this.skin_name];v&&v.call(this);this.setSortImgPos();s!=this.hdr.clientHeight&&this._ahgr&&this.setSizes();this.callEvent("onSetSizes",[])}}};this.setSizes_clear=function(){var e=this.hdr.offsetHeight,a=this.entBox.offsetWidth,b=e+this.objBox.offsetHeight;this._topMb.style.top=(e||0)+"px";this._topMb.style.width= a+20+"px";this._botMb.style.top=b-3+"px";this._botMb.style.width=a+20+"px"};this.chngCellWidth=function(){if(_isOpera&&this.ftr)this.ftr.width=this.objBox.scrollWidth+"px";for(var e=this._cCount,a=0;a1){for(var k=[],m=0;m(this._drsclmW&&!this._notresize?this._drsclmW[a]||10:10)){this.obj.rows[0].childNodes[a].style.width=b+"px";this.hdr.rows[0].childNodes[a].style.width=b+"px";if(this.ftr)this.ftr.rows[0].childNodes[a].style.width=b+"px";if(this.cellWidthType=="px")this.cellWidthPX[a]=b;else{var c=parseInt(this.entBox.offsetWidth);this.objBox.scrollHeight>this.objBox.offsetHeight&& (c-=17);var f=Math.round(b/c*100);this.cellWidthPC[a]=f}this.sortImg.style.display!="none"&&this.setSortImgPos()}};this.setSortImgState=function(a,b,c,f){c=(c||"asc").toLowerCase();if(convertStringToBoolean(a)){this.sortImg.src=c=="asc"?this.imgURL+"sort_asc.gif":this.imgURL+"sort_desc.gif";this.sortImg.style.display="";this.fldSorted=this.hdr.rows[0].childNodes[b];var d=this.hdr.rows[f||1];if(d){for(var h=0;hm)var n=m,o=k;else n=k,o=m;for(var p=0;p= n&&p<=o)if(this.rowsCol[p]&&!this.rowsCol[p]._sRow)this.rowsCol[p].className.indexOf("rowselected")==-1&&this.callEvent("onBeforeSelect",[this.rowsCol[p].idd,g])&&(this.rowsCol[p].className+=" rowselected",this.selectedRows[this.selectedRows.length]=this.rowsCol[p]);else return this.clearSelection(),this.doClick(a,b,0,f)}else if(d==2&&a.parentNode.className.indexOf("rowselected")!=-1){a.parentNode.className=a.parentNode.className.replace(/rowselected/g,"");this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(a.parentNode)); var r=!0,f=!1}this.editStop();if(typeof a.parentNode.idd=="undefined")return!0;if(!r&&!a.parentNode._sRow)if(this.callEvent("onBeforeSelect",[a.parentNode.idd,g]))if(this.getSelectedRowId()!=a.parentNode.idd){d==0&&this.clearSelection();this.cell=a;l==a.parentNode&&this._chRRS&&(b=!1);this.row=a.parentNode;this.row.className+=" rowselected";if(this.cell&&_isIE&&_isIE==8){var s=this.cell.nextSibling,t=this.cell.parentNode;t.removeChild(this.cell);t.insertBefore(this.cell,s)}if(this.selectedRows._dhx_find(this.row)== -1)this.selectedRows[this.selectedRows.length]=this.row}else this.cell=a,this.row=a.parentNode;else b=!1;if(this.cell&&this.cell.parentNode.className.indexOf("rowselected")!=-1)this.cell.className=this.cell.className.replace(/cellselected/g,"")+" cellselected";if(d!=1&&!this.row)return;this.lastClicked=a.parentNode;var u=this.row.idd,q=this.cell;b&&typeof u!="undefined"&&q&&!r?c.onRowSelectTime=setTimeout(function(){c.callEvent&&c.callEvent("onRowSelect",[u,q._cellIndex])},100):this.callEvent("onRowSelectRSOnly", [u]);if(this.checkEvent("onSelectStateChanged")){var v=this.getSelectedId();h!=v&&this.callEvent("onSelectStateChanged",[v,h])}}this.isActive=!0;f!==!1&&this.cell&&this.cell.parentNode.idd&&this.moveToVisible(this.cell)};this.selectAll=function(){this.clearSelection();var a=this.rowsBuffer;if(this.pagingOn)a=this.rowsCol;for(var b=0;bthis.objBox.offsetWidth+this.objBox.scrollLeft?a.offsetLeft>this.objBox.scrollLeft&&(g=a.offsetLeft-5):a.offsetLeftthis.objBox.offsetHeight+this.objBox.scrollTop)var k= l-this.objBox.offsetHeight;else d(new Date).valueOf())return;this._Opera_stop=null}if(this.editor&&this.editor!=null)if(this.editor.cell.className=this.editor.cell.className.replace("editable",""),a){var b=this.editor.val;this.editor.detach();this.editor.setValue(b);this.editor=null;this.callEvent("onEditCancel",[this.row.idd, this.cell._cellIndex,b])}else{if(this.editor.detach())this.cell.wasChanged=!0;var c=this.editor;this.editor=null;var d=this.callEvent("onEditCell",[2,this.row.idd,this.cell._cellIndex,c.getValue(),c.val]);if(typeof d=="string"||typeof d=="number")c[c.setImage?"setLabel":"setValue"](d);else if(!d)c[c.setImage?"setLabel":"setValue"](c.val);this._ahgr&&this.multiLine&&this.setSizes()}};this._nextRowCell=function(a,b,c){a=this._nextRow((this._groups?this.rowsCol:this.rowsBuffer)._dhx_find(a),b);return!a? null:a.childNodes[a._childIndexes?a._childIndexes[c]:c]};this._getNextCell=function(a,b,c){var a=a||this.cell,d=a.parentNode;this._tabOrder?(c=this._tabOrder[a._cellIndex],typeof c!="undefined"&&(a=c<0?this._nextRowCell(d,b,Math.abs(c)-1):d.childNodes[c])):(c=a._cellIndex+b,c>=0&&c=this.rowsBuffer.length&&(c=this.rowsBuffer.length-1);if(this._srnd&&!this.rowsBuffer[c]){this.objBox.scrollTop+=Math.floor(a*this.objBox.offsetHeight/(this._srdh||20))*(this._srdh||20);if(this._fake)this._fake.objBox.scrollTop=this.objBox.scrollTop;b._r_select=c}else{this.selectCell(c,this.cell._cellIndex,!0,!1,!1,this.multiLine||this._srnd);if(!this.multiLine&&!this._srnd&&!this._realfake&&(this.objBox.scrollTop=this.getRowById(this.getRowId(c)).offsetTop, this._fake))this._fake.objBox.scrollTop=this.objBox.scrollTop;b._r_select=null}}};this.doKey=function(a){if(!a)return!0;if((a.target||a.srcElement).value!==window.undefined){var b=a.target||a.srcElement;if(!b.parentNode||b.parentNode.className.indexOf("editable")==-1)return!0}if(globalActiveDHTMLGridObject&&this!=globalActiveDHTMLGridObject)return globalActiveDHTMLGridObject.doKey(a);if(this.isActive==!1)return!0;if(this._htkebl)return!0;if(!this.callEvent("onKeyPress",[a.keyCode,a.ctrlKey,a.shiftKey, a]))return!1;var c="k"+a.keyCode+"_"+(a.ctrlKey?1:0)+"_"+(a.shiftKey?1:0);if(this.cell){if(this._key_events[c]){if(!1===this._key_events[c].call(this))return!0;a.preventDefault&&a.preventDefault();a.cancelBubble=!0;return!1}this._key_events.k_other&&this._key_events.k_other.call(this,a)}return!0};this.selectRow=function(a,b,c,d){typeof a!="object"&&(a=this.render_row(a));this.selectCell(a,0,b,c,!1,d)};this.wasDblClicked=function(a){var b=this.getFirstParentOfType(_isIE?a.srcElement:a.target,"TD"); if(b){var c=b.parentNode.idd;return this.callEvent("onRowDblClicked",[c,b._cellIndex])}};this._onHeaderClick=function(a,b){var c=this.grid,b=b||c.getFirstParentOfType(_isIE?event.srcElement:a.target,"TD");if(this.grid.resized==null){if(!this.grid.callEvent("onHeaderClick",[b._cellIndexS,a||window.event]))return!1;c.sortField(b._cellIndexS,!1,b)}this.grid.resized=null};this.deleteSelectedRows=function(){var a=this.selectedRows.length;if(a!=0){var b=this.selectedRows;this.selectedRows=dhtmlxArray(); for(var c=a-1;c>=0;c--){var d=b[c];if(this.deleteRow(d.idd,d)){if(d==this.row)var g=c}else this.selectedRows[this.selectedRows.length]=d}if(g)try{g+1>this.rowsCol.length&&g--,this.selectCell(g,0,!0)}catch(h){this.cell=this.row=null}}};this.getSelectedRowId=function(){for(var a=[],b={},c=0;c";var l=new Image;l.src=this.imgURL+""+b.replace(/(\.[a-z]+)/,".des$1");this.preloadImagesAr[this.preloadImagesAr.length]=l; var k=new Image;k.src=this.imgURL+""+b.replace(/(\.[a-z]+)/,".asc$1");this.preloadImagesAr[this.preloadImagesAr.length]=k}else{var m="
";if(b.indexOf("img:[")!=-1){var n=b.replace(/.*\[([^>]+)\].*/,"$1"),b=b.substr(b.indexOf("]")+1,b.length);m+=""}m+=b;m+="
";g.cells[h].innerHTML=m;if(this._hstyles[h])g.cells[h].style.cssText=this._hstyles[h]}if((b||"").indexOf("#")!=-1){var o=b.match(/(^|{)#([^}]+)(}|$)/); if(o){var p="_in_header_"+o[2];if(this[p])this[p](this.forceDivInHeader?g.cells[h].firstChild:g.cells[h],h,b.split(o[0]))}}}};this.setColLabel=function(a,b,c,d){return this.setColumnLabel(a,b,(c||0)+1,d)};this.clearAll=function(a){if(this.obj.rows[0]){if(this._h2&&(this._h2=new dhtmlxHierarchy,this._fake))this._realfake?this._h2=this._fake._h2:this._fake._h2=this._h2;this.limit=this._limitC=0;this.editStop(!0);this._dLoadTimer&&window.clearTimeout(this._dLoadTimer);if(this._dload)this.objBox.scrollTop= 0,this.limit=this._limitC||0,this._initDrF=!0;for(var b=this.rowsCol.length,b=this.obj.rows.length,c=b-1;c>0;c--){var d=this.obj.rows[c];d.parentNode.removeChild(d)}if(a){this._master_row=null;this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]);for(c=this.hdr.rows.length-1;c>=0;c--)d=this.hdr.rows[c],d.parentNode.removeChild(d);if(this.ftr)this.ftr.parentNode.removeChild(this.ftr),this.ftr=null;this._aHead=this.ftr=this.cellWidth=this._aFoot=null;this.cellType=dhtmlxArray();this._hrrar=[];this.columnIds= [];this.combos=[];this._strangeParams=[];this.defVal=[];this._ivizcol=null}this.cell=this.row=null;this.rowsCol=dhtmlxArray();this.rowsAr={};this._RaSeCol=[];this.rowsBuffer=dhtmlxArray();this.UserData=[];this.selectedRows=dhtmlxArray();if(this.pagingOn||this._srnd)this.xmlFileUrl="";this.pagingOn&&this.changePage(1);this._contextCallTimer&&window.clearTimeout(this._contextCallTimer);this._sst&&this.enableStableSorting(!0);this._fillers=this.undefined;this.setSortImgState(!1);this.setSizes();this.callEvent("onClearAll", [])}};this.sortField=function(a,b,c){if(this.getRowsNum()==0)return!1;var d=this.hdr.rows[0].cells[a];if(d&&d.tagName=="TH"&&this.fldSort.length-1>=d._cellIndex&&this.fldSort[d._cellIndex]!="na"){var g=this.getSortingState(),h=g[0]==a&&g[1]=="asc"?"des":"asc";if(this.callEvent("onBeforeSorting",[a,this.fldSort[a],h])){this.sortImg.src=this.imgURL+"sort_"+(h=="asc"?"asc":"desc")+".gif";if(this.useImagesInHeader){var l=this.hdr.rows[1].cells[d._cellIndex].firstChild;if(this.fldSorted!=null){var k=this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild; k.src=k.src.replace(/(\.asc\.)|(\.des\.)/,".")}l.src=l.src.replace(/(\.[a-z]+)$/,"."+h+"$1")}this.sortRows(d._cellIndex,this.fldSort[d._cellIndex],h);this.fldSorted=d;this.r_fldSorted=c;var m=this.hdr.rows[1],m=c.parentNode,n=m._childIndexes?m._childIndexes[d._cellIndex]:d._cellIndex;this.setSortImgPos(!1,!1,!1,c)}}};this.enableHeaderImages=function(a){this.useImagesInHeader=a};this.setHeader=function(a,b,c){for(var d=typeof a!="object"?this._eSplit(a):[].concat(a),g=[],h=new dhtmlxArray(0),l=[], k=[],m=[],n=0;n8.5)this.hdr.onmousemove=function(a){this.grid.changeCursorState(a||window.event)},this.hdr.onmousedown=function(a){return this.grid.startColResize(a||window.event)};this.obj.onmousemove=this._drawTooltip;this.objBox.onclick=function(a){(a||event).cancelBubble=!0};this.obj.onclick=function(a){this.grid._doClick(a||window.event);this.grid._sclE?this.grid.editCell(a||window.event):this.grid.editStop();(a||event).cancelBubble=!0};_isMacOS?this.entBox.oncontextmenu=function(a){a.cancelBubble= !0;a.returnValue=!1;return this.grid._doContClick(a||window.event)}:(this.entBox.onmousedown=function(a){return this.grid._doContClick(a||window.event)},this.entBox.oncontextmenu=function(a){if(this.grid._ctmndx)(a||event).cancelBubble=!0;return!this.grid._ctmndx});this.obj.ondblclick=function(a){if(!this.grid.wasDblClicked(a||window.event))return!1;if(this.grid._dclE){var b=this.grid.getFirstParentOfType(_isIE?event.srcElement:a.target,"TR");b==this.grid.row&&this.grid.editCell(a||window.event)}(a|| event).cancelBubble=!0;if(_isOpera)return!1};this.hdr.onclick=this._onHeaderClick;this.sortImg.onclick=function(){c._onHeaderClick.apply({grid:c},[null,c.r_fldSorted])};this.hdr.ondblclick=this._onHeaderDblClick;if(!document.body._dhtmlxgrid_onkeydown)dhtmlxEvent(document,"keydown",function(a){if(globalActiveDHTMLGridObject)return globalActiveDHTMLGridObject.doKey(a||window.event)}),document.body._dhtmlxgrid_onkeydown=!0;dhtmlxEvent(document.body,"click",function(){c.editStop&&c.editStop();c.isActive&& c.setActive(!1)});this.entBox.onbeforeactivate=function(){this._still_active=null;this.grid.setActive();event.cancelBubble=!0};this.entBox.onbeforedeactivate=function(){this.grid._still_active?this.grid._still_active=null:this.grid.isActive=!1;event.cancelBubble=!0};if(this.entBox.style.height.toString().indexOf("%")!=-1)this._delta_y=this.entBox.style.height;if(this.entBox.style.width.toString().indexOf("%")!=-1)this._delta_x=this.entBox.style.width;(this._delta_x||this._delta_y)&&this._setAutoResize(); this.setColHidden=this.setColumnsVisibility;this.enableCollSpan=this.enableColSpan;this.setMultiselect=this.enableMultiselect;this.setMultiLine=this.enableMultiline;this.deleteSelectedItem=this.deleteSelectedRows;this.getSelectedId=this.getSelectedRowId;this.getHeaderCol=this.getColumnLabel;this.isItemExists=this.doesRowExist;this.getColumnCount=this.getColumnsNum;this.setSelectedRow=this.selectRowById;this.setHeaderCol=this.setColumnLabel;this.preventIECashing=this.preventIECaching;this.enableAutoHeigth= this.enableAutoHeight;this.getUID=this.uid;dhtmlx.image_path&&this.setImagePath(dhtmlx.image_path);dhtmlx.skin&&this.setSkin(dhtmlx.skin);return this} dhtmlXGridObject.prototype={getRowAttribute:function(a,b){return this.getRowById(a)._attrs[b]},setRowAttribute:function(a,b,c){this.getRowById(a)._attrs[b]=c},isTreeGrid:function(){return this.cellType._dhx_find("tree")!=-1},setRowHidden:function(a,b){var c=convertStringToBoolean(b),d=this.getRowById(a);if(d){d.expand===""&&this.collapseKids(d);if(b&&d.style.display!="none"){d.style.display="none";var e=this.selectedRows._dhx_find(d);if(e!=-1){d.className=d.className.replace("rowselected","");for(var i= 0;i0){var i=this[e];this[e]=this[e+1];this[e+1]=i}c--}}},enableKeyboardSupport:function(a){this._htkebl=!convertStringToBoolean(a)},enableContextMenu:function(a){this._ctmndx=a},setScrollbarWidthCorrection:function(){},enableTooltips:function(a){this._enbTts=a.split(",");for(var b=0;b0){this.hdr.rows.length>0&&this.clearAll(!0);for(var f=[[],[], [],[],[],[],[],[],[]],g=",width,type,align,sort,color,format,hidden,id".split(","),h=["",e,"setColTypes","setColAlign","setColSorting","setColumnColor","","","setColumnIds"],l=0;l0){this.UserData.gridglobaluserdata||(this.UserData.gridglobaluserdata=new Hashtable);for(k=0;k=this.grid._cCount)){var e=this.grid.cells3(c,b._cellIndex);if(e&&e.cell&&e.cell._attrs){if(d._title)e.cell.title= "";if(!e.cell._attrs.title)d._title=!0;if(e)d.title=e.cell._attrs.title||(e.getTitle?e.getTitle():(e.getValue()||"").toString().replace(/<[^>]*>/gi,""));return!0}}}},enableCellWidthCorrection:function(a){if(_isFF)this._wcorr=parseInt(a)},getAllRowIds:function(a){for(var b=[],c=0;cc&&(c=f))}c+=20+(b||0);this._setColumnSizeR(a,c); this._notresize=!1;this.setSizes()}},detachHeader:function(a,b){var b=b||this.hdr,c=b.rows[a+1];c&&c.parentNode.removeChild(c);this.setSizes()},detachFooter:function(a){this.detachHeader(a,this.ftr)},attachHeader:function(a,b,c){typeof a=="string"&&(a=this._eSplit(a));typeof b=="string"&&(b=b.split(this.delim));c=c||"_aHead";if(this.hdr.rows.length)if(a)this._createHRow([a,b],this[c=="_aHead"?"hdr":"ftr"]);else{if(this[c])for(var d=0;d1){for(var h=b.rows.length-2,l=!1,g=null;!l;){for(var g= b.rows[h],k=0;k"+(a[0][j]||" ")+"":a[0][j]||" ",(a[0][j]||"").indexOf("#")!=-1)if(d=a[0][j].match(/(^|{)#([^}]+)(}|$)/)){var n="_in_header_"+ d[2];if(this[n])this[n](this.forceDivInHeader?m.firstChild:m,j,a[0][j].split(d[0]))}if(f)m.style.cssText=f[j];c.appendChild(m)}var o=b;if(_isKHTML)b._kTimer&&window.clearTimeout(b._kTimer),b._kTimer=window.setTimeout(function(){b.rows[1].style.display="none";window.setTimeout(function(){b.rows[1].style.display=""},1)},500)},forEachRow:function(a){for(var b in this.rowsAr)this.rowsAr[b]&&this.rowsAr[b].idd&&a.apply(this,[this.rowsAr[b].idd])},forEachRowA:function(a){for(var b=0;bb.c?1:-1});for(d=0;d"],c=0;c");b.push("");a.innerHTML=b.join("");this._master_row=a.firstChild.rows[0]},_prepareRow:function(a){this._master_row|| this._build_master_row();for(var b=this._master_row.cloneNode(!0),c=0;c=0;i--){for(var j="",f=0;f0;){var j=_isIE?Math.min(i,5E4):i,f=this._add_filler(b,j);f&&this._fillers.push(f);i-=j; b+=j}}this.setSizes()},render_row:function(a){if(!this.rowsBuffer[a])return-1;if(this.rowsBuffer[a]._parser){var b=this.rowsBuffer[a];if(this.rowsAr[b.idd]&&this.rowsAr[b.idd].tagName=="TR")return this.rowsBuffer[a]=this.rowsAr[b.idd];var c=this._prepareRow(b.idd);this.rowsBuffer[a]=c;this.rowsAr[b.idd]=c;b._parser.call(this,c,b.data);this._postRowProcessing(c);return c}return this.rowsBuffer[a]},_get_cell_value:function(a,b,c){return a._locator?(this._c_order&&(b=this._c_order[b]),a._locator.call(this, a.data,b)):this.cells3(a,b)[c?c:"getValue"]()},sortRows:function(a,b,c){c=(c||"asc").toLowerCase();b=b||this.fldSort[a];a=a||0;if(this.isTreeGrid())this.sortTreeRows(a,b,c);else{var d={},e=this.cellType[a],i="getValue";e=="link"&&(i="getContent");if(e=="dhxCalendar"||e=="dhxCalendarA")i="getDate";for(var j=0;jd[b.idd]?1:-1:d[a.idd]=0;d--)b.parentNode.childNodes[d].tagName=="TR"&&b.parentNode.removeChild(b.parentNode.childNodes[d],!0);else if(_isIE)for(d=b.childNodes.length-1;d>=0;d--)b.childNodes[d].removeNode(!0); else b.innerHTML="";b.appendChild(c);this.rowsCol=dhtmlxArray();this._sst&&this.enableStableSorting(!0);this._fillers=this.undefined;a||this.render_dataset()}},deleteRow:function(a,b){b||(b=this.getRowById(a));if(b){this.editStop();if(!this._realfake&&this.callEvent("onBeforeRowDeleted",[a])==!1)return!1;var c=0;if(this.cellType._dhx_find("tree")!=-1&&!this._realfake)c=this._h2.get[a].parent.id,this._removeTrGrRow(b);else{b.parentNode&&b.parentNode.removeChild(b);var d=this.rowsCol._dhx_find(b);d!= -1&&this.rowsCol._dhx_removeAt(d);for(var e=0;e=d?i[0]-=1:i[1]>=d&&(i[1]-=1))}this._update_srnd_view()}this.pagingOn&&this.changePage();this._realfake||this.callEvent("onAfterRowDeleted", [a,c]);this.callEvent("onGridReconstructed",[]);this._ahgr&&this.setSizes();return!0}},_addRow:function(a,b,c){if(c==-1||typeof c=="undefined")c=this.rowsBuffer.length;typeof b=="string"&&(b=b.split(this.delim));var d=this._prepareRow(a);d._attrs={};for(var e=0;e=c)f[1]+=1,f[2].firstChild.style.height=parseInt(f[2].firstChild.style.height)+this._srdh+"px",i=!0,this._fake&&this._fake._fillers[j][1]++;f&&f[0]>c&&(f[0]+=1,this._fake&&this._fake._fillers[j][0]++)}i||this._fillers.push(this._add_filler(c, 1,c==0?{parentNode:this.obj.rows[0].parentNode,nextSibling:this.rowsCol[1]}:this.rowsCol[c-1]));return d}this.rowsBuffer._dhx_insertAt(c,d);return this._insertRowAt(d,c)},addRow:function(a,b,c){var d=this._addRow(a,b,c);this.dragContext||this.callEvent("onRowAdded",[a]);this.pagingOn&&this.changePage(this.currentPage);this._srnd&&this._update_srnd_view();d._added=!0;this._ahgr&&this.setSizes();this.callEvent("onGridReconstructed",[]);return d},_insertRowAt:function(a,b,c){this.rowsAr[a.idd]=a;if(this._skipInsert)return this._skipInsert= !1,a;if(b<0||!b&&parseInt(b)!==0)b=this.rowsCol.length;else if(b>this.rowsCol.length)b=this.rowsCol.length;this._cssEven&&(a.className+=(this._cssSP?this.getLevel(a.idd):b)%2==1?" "+this._cssUnEven+(this._cssSU?" "+this._cssUnEven+"_"+this.getLevel(a.idd):""):" "+this._cssEven+(this._cssSU?" "+this._cssEven+"_"+this.getLevel(a.idd):""));c||(b==this.obj.rows.length-1||!this.rowsCol[b]?_isKHTML?this.obj.appendChild(a):this.obj.firstChild.appendChild(a):this.rowsCol[b].parentNode.insertBefore(a,this.rowsCol[b])); this.rowsCol._dhx_insertAt(b,a);this.callEvent("onRowInserted",[a,b]);return a},getRowById:function(a){var b=this.rowsAr[a];if(b){if(b.tagName!="TR"){for(var c=0;c0?convertStringToBoolean(a): !0},setExternalTabOrder:function(a,b){var c=this;this.tabStart=typeof a=="object"?a:document.getElementById(a);this.tabStart.onkeydown=function(a){var b=a||window.event;if(b.keyCode==9&&!b.shiftKey)return b.cancelBubble=!0,c.selectCell(0,0,0,0,1),c.smartTabOrder&&c.cells2(0,0).isDisabled()&&c._key_events.k9_0_0.call(c),this.blur(),!1};if(_isOpera)this.tabStart.onkeypress=this.tabStart.onkeydown;this.tabEnd=typeof b=="object"?b:document.getElementById(b);this.tabEnd.onkeydown=this.tabEnd.onkeypress= function(a){var b=a||window.event;if(b.keyCode==9&&b.shiftKey)return b.cancelBubble=!0,c.selectCell(c.getRowsNum()-1,c.getColumnCount()-1,0,0,1),c.smartTabOrder&&c.cells2(c.getRowsNum()-1,c.getColumnCount()-1).isDisabled()&&c._key_events.k9_0_1.call(c),this.blur(),!1};if(_isOpera)this.tabEnd.onkeypress=this.tabEnd.onkeydown},uid:function(){if(!this._ui_seed)this._ui_seed=(new Date).valueOf();return this._ui_seed++},clearAndLoad:function(){var a=this._pgn_skin;this._pgn_skin=null;this.clearAll();this._pgn_skin= a;this.load.apply(this,arguments)},getStateOfView:function(){if(this.pagingOn){var a=(this.currentPage-1)*this.rowsBufferOutSize;return[this.currentPage,a,Math.min(a+this.rowsBufferOutSize,this.rowsBuffer.length),this.rowsBuffer.length]}return[Math.floor(this.objBox.scrollTop/this._srdh),Math.ceil(parseInt(this.objBox.offsetHeight)/this._srdh),this.rowsBuffer.length]}}; (function(){function a(a,b){this[a]=b}function b(a,b){this[a].call(this,b)}function c(a,b){this[a].call(this,b.join(this.delim))}function d(a,b){for(var c=0;c