var cart_grid_mode_client=0,cart_grid_mode_server=1,cart_grid_mode_callback=2; function ComponentArt_GridLevel(){ this.Columns=null; this.DataKeyField=-1; this.TableName=null; this.FilterExpression=null; this.NumGroupings=0; this.Groups=null; }; function ComponentArt_GridGroup(qg21,column,columnValue){ this.Index=0; this.Grid=null; this.Level=0; this.Column=column; this.ColumnValue=columnValue; this.Groups=null; this.Rows=[]; this.Expanded=false; }; ComponentArt_GridGroup.prototype.qzzp=function(){ var qza=[]; this.Grid.RenderExpandCollapseCell(qza,this,true,false,true,true); return qza.join(''); }; function ComponentArt_GridTable(){ this.Path=null; this.Level=0; this.Columns=null; this.ColumnDisplayOrder=null; this.Data=null; this.Grid=null; }; ComponentArt_GridTable.prototype.AddRow=function(){ this.Grid.AddingRow=true; if(this.Grid.RunningMode==cart_grid_mode_client){ this.Data.push([]); this.Grid.EditingId=this.GetRow(this.Data.length-1).ClientId; if(this.Level==0){ this.Grid.RecordCount++; this.Grid.PageCount=Math.ceil(this.Grid.RecordCount/this.Grid.PageSize); this.Grid.CurrentPageIndex=this.Grid.PageCount-1; }; this.Grid.Render(); } else{ this.Grid.RecordEvent("ADDROW "+this.Level); if(this.Grid.RunningMode==cart_grid_mode_callback){ this.Grid.Callback(0,null,this.Grid.GetEventList()); } else{ this.Grid.Postback(); }; }; }; ComponentArt_GridTable.prototype.GetRow=function(index,group){ if(!this.Data||this.Data.length<=index){ return null; }; var qg19=new ComponentArt_GridItem(),qg5=this.Data[index]; qg19.Table=this; qg19.Level=this.Level; qg19.Path=this.Path.concat(index); qg19.qg10=qg19.Path.join('_'); qg19.Id=(this.DataKeyField>=0?qg5[this.DataKeyField]:null); qg19.ServerId=qg19.Id?qg19.Level+' '+qg19.Id:null; qg19.ClientId=qg19.ServerId?qg19.ServerId:qg19.qg10; qg19.Expanded=this.Grid.IsInList(this.Grid.ExpandedList,qg19.ServerId,qg19.ClientId); qg19.Selected=this.Grid.IsInList(this.Grid.SelectedList,qg19.ServerId,qg19.ClientId); qg19.Index=parseInt(index); this.LoadRowData(qg19,qg5); if(group){ qg19.PageIndex=Math.floor(group.Index/this.Grid.GroupingPageSize); qg19.FirstInPage=false; qg19.LastInPage=(group.Rows[group.Rows.length-1]==index); } else{ qg19.PageIndex=Math.floor(index/this.Grid.PageSize); qg19.FirstInPage=(index%this.Grid.PageSize==0); qg19.LastInPage=((index+1)%this.Grid.PageSize==0); }; if(qg19.ChildTableData&&qg19.ChildTableData.length){ qg19.ChildTable=this.Grid.LoadTable(qg19.ChildTableData,qg19.Level+1,qg19.Path); }; return qg19; }; ComponentArt_GridTable.prototype.LoadRowData=function(qg19,qg5){ qg19.Data=qg5; for(var iCol=0;iColvalueB?1:-1); }; function ComponentArt_GridCell(value){ if(value&&value.constructor==Array){ if(value.length==3){ this.Object=value[0]; this.Text=value[1]; this.Value=value[2]; } else{ this.Object=value[0]; this.Value=value[0]; this.Text=value[1]; }; } else{ if(value&&value.constructor==String){ value=value.replace(/#%cLt#%/g,"<"); }; this.Object=value==undefined?null:value; this.Value=this.Object; this.Text=value==null?'':value; }; }; function ComponentArt_Grid(id){ this.Id=id; this.PageSize=0; this.CurrentPageIndex=0; this.qg9=null; this.HeaderDomObj=null; this.FooterDomObj=null; this.OuterFrameDomObj=null; this.FrameDomObj=null; this.SearchString=''; this.StyleInfo=null; this.Data=null; this.Table=null; this.Levels=null; }; ComponentArt_Grid.prototype.CollapseHandler=function(qzim,qzgx,qg30,object){ if(object.Id){ for(var qzba=0;qzba=0?this.Levels[level].Table.Columns[c]:null; if(qg30==null&&qg15){ if(level==0&&this.DownAction!='RESIZE'){ if(qg15.AllowSorting){ if(this.Levels[0].SortColumn==c){ this.Levels[0].SortDirection=!this.Levels[0].SortDirection; } else{ this.Levels[0].SortColumn=c; this.Levels[0].SortDirection=qg15.DefaultSortDirection; }; return this.Sort(this.Levels[0].SortColumn,this.Levels[0].SortDirection); } else{ return false; }; }; } else{ if(!(qg15&&qg15.EditControlType&&qg15.EditControlType=='EditCommand')){ var bMultipleSelect=qzim.ctrlKey&&this.AllowMultipleSelect; this.SelectPath(qg30,bMultipleSelect); }; }; return true; }; ComponentArt_Grid.prototype.MoveHandler=function(qzim,qzgx,displayCol,level){ if(this.IsResizing){ return false; }; var offsetX; if(cart_browser_ie){ offsetX=qzim.offsetX; } else{ offsetX=qzim.pageX-qzAfx(qzgx); }; var qg21=this.Levels[level],c=qg21.Table.ColumnDisplayOrder[displayCol]; if(offsetX<3&&displayCol!=0&&!qg21.Table.Columns[qg21.Table.ColumnDisplayOrder[displayCol-1]].FixedWidth){ this.FrameDomObj.style.cursor='e-resize'; this.DownAction='RESIZE'; this.DownObject=qzgx.previousSibling; this.DownActionParameter=displayCol-1; } else if(offsetX>qzgx.offsetWidth-3&&displayCol!=qg21.Table.ColumnDisplayOrder.length-1&&!qg21.Table.Columns[c].FixedWidth){ this.FrameDomObj.style.cursor='e-resize'; this.DownAction='RESIZE'; this.DownObject=qzgx; this.DownActionParameter=displayCol; } else{ this.FrameDomObj.style.cursor=this.CursorStyle; var qg15=qg21.Table.Columns[c]; if(qg15.AllowReordering||qg15.AllowGrouping){ this.DownAction='DRAG'; } else{ this.DownAction='NONE'; }; this.DownActionParameter=displayCol; }; return false; }; ComponentArt_Grid.prototype.OverHandler=function(qzim,qzgx,level){ if(this.IsResizing){ return false; }; var qg30=this.GetPathFromObj(qzgx); if(qg30==null){ if(this.Levels[level].HeadingCellHoverCssClass){ if(!cart_browser_ie||!ComponentArt_Contains(qzgx,ComponentArt_FromElement(qzim))){ qzgx.className+=' '+this.Levels[level].HeadingCellHoverCssClass; }; }; return false; }; this.DownAction='NONE'; this.FrameDomObj.style.cursor=this.CursorStyle; if(!qzgx.styleCached){ qzgx.styleInfo=this.StyleInfo[qg30]; qzgx.styleCached=true; }; if(!qzgx.styleInfo.Selected&&qzgx.styleInfo.HoverRowClass){ qzgx.className=qzgx.styleInfo.HoverRowClass; }; return false; }; ComponentArt_Grid.prototype.OutHandler=function(qzim,qzgx,level){ if(this.IsResizing){ return false; }; var qg30=this.GetPathFromObj(qzgx); if(qg30==null){ this.DownAction==''; this.FrameDomObj.style.cursor=this.CursorStyle; if(this.Levels[level].HeadingCellHoverCssClass){ if(!cart_browser_ie||!ComponentArt_Contains(qzgx,ComponentArt_ToElement(qzim))){ qzgx.className=this.Levels[level].HeadingCellCssClass; }; }; return false; }; if(!qzgx.styleInfo.Selected&&qzgx.styleInfo.HoverRowClass&&qzgx.styleInfo.RowClass){ qzgx.className=qzgx.styleInfo.RowClass; }; return false; }; ComponentArt_Grid.prototype.DownHandler=function(qzim,qzgx,c,level){ var qg30=this.GetPathFromObj(qzgx.parentNode); if(qg30==null&&this.DownAction!='RESIZE'){ var activeClass=this.Levels[level].HeadingCellActiveCssClass; if(activeClass){ qzgx.className+=' '+activeClass; }; }; if(this.DownAction=='RESIZE'){ this.ResizingStart=cart_browser_ie?event.clientX+document.body.scrollLeft:qzim.pageX; this.ResizingDisplayColumn=this.DownActionParameter; this.ResizingLevel=level; this.IsResizing=true; var mouseX=cart_browser_ie?event.clientX+document.body.scrollLeft:qzim.pageX; this.ResizeTop=qzAfw(this.DownObject); this.ResizeHeight=this.FrameDomObj.offsetHeight+qzAfw(this.FrameDomObj)-this.ResizeTop; this.ResizeStartX=qzAfx(this.DownObject)+this.DownObject.offsetWidth; this.ResizeOffsetX=mouseX-this.ResizeStartX; this.ResizeDraggingObject=document.createElement('div'); this.ResizeDraggingObject.style.width='1px'; this.ResizeDraggingObject.style.backgroundColor='black'; this.ResizeDraggingObject.style.top=this.ResizeTop+'px'; this.ResizeDraggingObject.style.left=this.ResizeStartX+'px'; this.ResizeDraggingObject.style.height=this.ResizeHeight+'px'; this.ResizeDraggingObject.style.position='absolute'; this.ResizeDraggingObject.style.cursor='e-resize'; document.body.insertBefore(this.ResizeDraggingObject,document.body.firstChild); this.ResizeLeftObject=document.createElement('div'); this.ResizeLeftObject.style.width='1px'; this.ResizeLeftObject.style.backgroundColor='black'; this.ResizeLeftObject.style.top=this.ResizeTop+'px'; this.ResizeLeftObject.style.left=qzAfx(this.DownObject)+'px'; this.ResizeLeftObject.style.height=this.ResizeHeight+'px'; this.ResizeLeftObject.style.position='absolute'; document.body.insertBefore(this.ResizeLeftObject,document.body.firstChild); ComponentArt_Grid_ResizeGrid=this; this.FrameDomObj.style.cursor='e-resize'; document.onmousemove=ComponentArt_Grid_ResizeDragHandler; document.onmouseup=ComponentArt_Grid_ResizeDropHandler; ComponentArt_CancelEvent(qzim); } else if(this.DownAction=='DRAG'&&!qg30){ this.DraggingLevel=level; this.DraggingDisplayColumn=this.DownActionParameter; this.DraggingRowObj=qzgx.parentNode; this.IsDragging=true; this.IsGroupDragging=false; this.DragOffsetX=cart_browser_ie?event.offsetX:qzim.pageX-qzAfx(qzgx); this.DragOffsetY=cart_browser_ie?event.offsetY:qzim.pageY-qzAfw(qzgx); ComponentArt_Grid_DragGrid=this; document.onmousemove=ComponentArt_Grid_DragHandler; document.onmouseup=ComponentArt_Grid_DropHandler; ComponentArt_CancelEvent(qzim); } else{ }; return false; }; ComponentArt_Grid.prototype.UpHandler=function(qzim,qzgx,c,level){ if(this.IsDragging){ this.IsDragging=false; } else if(this.IsResizing){ this.IsResizing=false; } else{ if(cart_browser_ie){ if(qzim.button!=2){ return true; }; } else{ if(qzim.which!=3){ return true; }; }; ComponentArt_CancelEvent(qzim); var qg30=this.GetPathFromObj(qzgx.parentNode); if(qg30!=null&&this.OnContextMenu){ var qg24=this.GetRowFromPath(qg30); this.OnContextMenu(qg24,qg24.Table.Columns[c],qzim); }; return false; }; return true; }; ComponentArt_Grid.prototype.GroupClickHandler=function(qzim,qzgx,c){ ComponentArt_CancelEvent(qzim); if(this.Groupings&&this.Groupings.length>0){ var sortDesc=this.Groupings[0].indexOf(' 1')>0?true:false; this.Group(c,!sortDesc); }; return false; }; ComponentArt_Grid.prototype.GroupDownHandler=function(qzim,qzgx,c){ ComponentArt_CancelEvent(qzim); this.DraggingLevel=0; this.DraggingDisplayColumn=c; this.IsDragging=true; this.IsGroupDragging=true; this.DragOffsetX=cart_browser_ie?event.offsetX:qzim.pageX-qzAfx(qzgx); this.DragOffsetY=cart_browser_ie?event.offsetY:qzim.pageY-qzAfw(qzgx); ComponentArt_Grid_DragGrid=this; document.onmousemove=ComponentArt_Grid_DragHandler; document.onmouseup=ComponentArt_Grid_DropHandler; return false; }; ComponentArt_Grid.prototype.SearchCheckEnter=function(qzim){ if(cart_browser_ie){ qzim=window.event; qztk=qzim.keyCode; } else{ qztk=qzim.which; }; var isEnter=(qztk==13); if(isEnter&&!this.SearchOnKeyPress){ var searchBox=document.getElementById(this.Id+'_searchBox'); if(searchBox){ this.SearchExecute(searchBox); }; }; return isEnter; }; ComponentArt_Grid.prototype.SearchExecute=function(searchBox){ if(searchBox.value!=this.SearchString){ this.SearchString=searchBox.value.replace('\'','\\\''); if(this.SearchTimeout){ clearTimeout(this.SearchTimeout); }; this.SearchTimeout=setTimeout(this.Id+'.Search("'+this.SearchString+'")',250); }; }; ComponentArt_Grid.prototype.SearchKeyHandler=function(qzim,qzgx){ var searchBox=document.getElementById(this.Id+'_searchBox'); if(searchBox&&this.SearchOnKeyPress){ this.SearchExecute(searchBox); }; }; ComponentArt_Grid.prototype.ResizeHandler=function(qzim){ if(document.body.offsetWidth!=this.WindowWidth){ var newWindowWidth=document.body.offsetWidth; if(this.ResizeTimeout){ clearTimeout(this.ResizeTimeout); }; var widthDiff=Math.round(this.GlobalPercentageWidth*(newWindowWidth-this.WindowWidth)); this.ResizeTimeout=setTimeout(this.Id+'.RedistributeWidth('+this.Id+'.Levels[0],'+this.Id+'.Levels[0].Table.Columns,'+this.Id+'.Levels[0].Table.ColumnDisplayOrder,'+widthDiff+', 0);'+this.Id+'.Render();'+this.Id+'.WindowWidth = '+newWindowWidth+';',100); }; if(this.OldWindowResize&&this.OldWindowResize!=this.ResizeHandler){ this.OldWindowResize(qzim); }; }; ComponentArt_Grid.prototype.ArrayToXml=function(arData,bEncode){ var oldArrayToString=Array.prototype.toString; Array.prototype.toString=function(){ return''+this.join('')+''; }; var sXml=arData.toString(); if(bEncode){ sXml=escape(sXml); }; Array.prototype.toString=oldArrayToString; return sXml; }; ComponentArt_Grid.prototype.DeleteSelected=function(){ for(var qzba=0;qzba",">").replace("<","<"); } else if(qg15.DataType==3){ value=inputObj.checked; }; arData[col]=value; }; }; var qg19=new ComponentArt_GridItem(); qg19.Table=qg24.Table; qg19.Level=qg24.Level; qg24.Table.LoadRowData(qg19,arData); if(this.AddingRow&&this.ClientSideOnInsert){ var iRetValue=this.ClientSideOnInsert(qg19); if(iRetValue==0){ this.EditCancel(); }; if(iRetValue!=1){ return false; }; } else if(!this.AddingRow&&this.ClientSideOnUpdate){ var iRetValue=this.ClientSideOnUpdate(qg24,qg19); if(iRetValue==0){ this.EditCancel(); }; if(iRetValue!=1){ return false; }; }; this.EditingId=null; this.EditingDirty=false; for(var qzba=0;qzba'; }; qza[qza.length]=''; } else{ switch(qg15.EditControlType){ case'TextArea':qza[qza.length]='