From ea472b9b5aa3629957c4e7cb698834a45adf718c Mon Sep 17 00:00:00 2001
From: fs-danaus <danaus314@qq.com>
Date: 星期三, 25 五月 2022 17:19:50 +0800
Subject: [PATCH] 处理47控件固定显示百分比

---
 /dev/null         |  493 -------------------------------------------------
 Grid/RenderRow.js |   12 
 Grid/DataOut.js   |   12 +
 core.js           |   42 ++-
 4 files changed, 44 insertions(+), 515 deletions(-)

diff --git a/Grid/DataIn.js.bak b/Grid/DataIn.js.bak
deleted file mode 100644
index 23eba45..0000000
--- a/Grid/DataIn.js.bak
+++ /dev/null
@@ -1,228 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// -----------------------------------------------------------------------------------------------------------
-var CNodeSec = {"LeftCols":0,"Cols":1,"RightCols":2}; 
-// -----------------------------------------------------------------------------------------------------------
-// Updates XML to begin with <Grid>, optionaly replaces entities, if it was coded
-// Return null for error (no tag <Grid>)
-TGP.PrepareData = function(Xml,DataIO){
-
-if(typeof(Xml)!="string") {
-   var X = Xml ? Xml.xml : null; 
-   if(X) Xml = X;        
-   else return typeof(Xml)=="object" ? Xml : null; 
-   }
-
-MS.JsonIn;  
-if(Xml.search(/^[^\<\&]*\{/)>=0) {
-   try { var A = new Function("return "+Xml.replace(/^[^\<\{]*\{/,'{').replace(/\}[^\}]*$/,'}')); A = A(); }
-   catch(e){
-      this.Debug(1,"Incorrect JSON data from "+this.DebugDataGetName(DataIO)+", error returned: ",(e.message?e.message:e));
-      if(this.DebugFlags["ioerror"] && !DataIO.Debug["in"]) this.DebugData(DataIO,Xml," JSON:");
-      return null;
-      }
-   return A;   
-   }
-ME.JsonIn;   
-   
-Xml = Xml.replace(/<!--[\s\S]*?-->/g,"");   
-var fr = Xml.search(/\<Grid\s*\>/); 
-if(fr<0) { 
-   fr = Xml.search(/\&lt\;Grid(\>|\&gt\;)/); 
-   if(fr<0) { 
-      MS.Debug; 
-      this.Debug(1,"No tag <Grid> found in XML data from "+this.DebugDataGetName(DataIO));
-      if(this.DebugFlags["ioerror"] && !DataIO.Debug["in"]) this.DebugData(DataIO,Xml," XML:");
-      ME.Debug;
-      if(Grids.OnDataError) Grids.OnDataError(this,DataIO,-4,null,Xml);
-     //*** if(DataIO.AlertError) alert("TreeeGrid communication error \r\n\r\nURL: "+DataIO.Url+" \r\n\r\n"+Xml);
-                  var fl="";
-                   if(Xml.indexOf("#|#@success")>-1){
-                   	var data=Xml.split("#|#");
-                   var onlinePament=null;
-                   try{
-                   	onlinePament=JSON.parse(new Base64().decode(data[1].replace("@success","")));
-                   	//console.log("onlinePament:"+onlinePament.onlinePay)
-                  }catch(e){
-                  	//console.log("e:"+e)
-                  	}
-                   //{"onlinePay":1,"onlineRefund":1}
-                   //绗﹀悎鏉′欢锛岃〃绀洪渶瑕佽皟鐢ㄦ敮浠�
-                   if(onlinePament!=null&&onlinePament!=""&&onlinePament.onlinePay!=-1){
-                   	var type="";
-                   	if(onlinePament.onlinePay==1){
-                   		//鍦ㄧ嚎鏀粯
-                   		type="pay";
-                   		
-                   	}
-                     //  else if(onlinePament.onlineRefund==1){
-                   	// 	//鍦ㄧ嚎閫�娆�
-                   	// 	type="refund";
-                   	// }
-                      else{
-                   		type="commit";
-                   	}
-                  OpenPayAndRefund(new Base64().decode(data[0]),type,this.formid);
-                  }else{
-                	this.tempCode=data[0];
-                	fl=data[2];
-                  if(this.aflg==3){//鐢变簬纭畾鏃跺厛璋冪敤淇濆瓨锛屾墍浠ュ湪杩欓噷浣滃垽鏂�
-                	this.doccode=this.tempCode;
-                	 postCheck(Xml,this);//浼犲埌澶栭潰hotkey.js璋冪敤
-               		//this.tran("",this.callback,this.aflg);
-               	//	this.aflg=0;//鍘绘帀3鐨勬儏鍐�
-                  }else{
-                  //澧炲姞寮瑰嚭鎻愮ず,閽堝鍙栨秷纭鎴愬姛鍚庤繑鍥� by2014-6-7
-                	if(data.length==6){
-                		if(procCallBack){
-                		procCallBack(data[5],1,0);
-                	}else{
-                		alert(data[5]);
-                	}
-                	}
-                    this.cM1(data[3],fl);
-                    if(typeof this.callback=='function'){//鏂板callback鍥炶皟鍑芥暟 hq 2010-08-11
-                	 this.callback(true,true);//鎵ц鎴愬姛
-                 } 
-               }
-             }
-             }else{
-             if(typeof this.callback=='function'){//鏂板callback鍥炶皟鍑芥暟 hq 2010-08-11
-             	this.Data.Upload.Url=this.Data.Upload.Url.replace("&canPric=1","");//***by 2014-6-3,澧炲姞鍙栨秷纭澶勭悊
-             	this.iscanelProc=false;//***杩欎釜鍊兼槸浠庨〉闈㈢偣鍑诲彇娑堢‘璁ゆ椂浼犺繘鏉�
-             	  var tsr=Xml;
-                    if(Xml.indexOf("tranError#|#")==0){
-                    	// by 2015-10-16鏈�鏂颁慨鏀癸紝涓嶉渶瑕佽繖鏍蜂簡锛屼繚瀛樺拰纭鍚堝苟涓�璧锋搷浣溿�俠y 2015-4-27 琛ㄧず纭鍑洪敊锛岄渶瑕佸埛鏂板綋鍓嶉〉闈紝閬垮厤杩樻槸鏂板崟鐘舵�侊紝鍐嶇‘璁ゆ椂浼氱敓鎴愰噸澶嶅崟鐨勯棶棰�
-                    	// this.cM1(Xml.split("#|#")[4],2);
-                    	 tsr=Xml.split("#|#")[1];
-                    	  alert(tsr);
-                    	   this.callback(false,false);//鎵ц鎴愬姛澶辫触
-                    }else if(Xml.indexOf("datacheckError#|#")==0){//鏁版嵁鑼冨洿妫�鏌ヨ繑鍥�
-                    	var check=2;
-                    	if(this.istran){
-                    		//琛ㄧず涔嬪墠鏄墽琛岀‘璁ゆ搷浣�
-                    		check=3;
-                    	}
-                    	this.callback(Xml.replace("datacheckError#|#",""),check);
-                    	return null;
-                    }else if(Xml.indexOf("pushError#|#")==0){//鎺ㄩ�佸嚭閿欒繑鍥�
-                    	alert(Xml.split("#|#")[1]);
-                      location.href=document.URL;
-                    	}else{
-                    alert(Xml);
-                    this.callback(false,false);//鍘绘帀鍔犺浇灞�
-                  }
-                 }else{
-                 	alert(Xml);
-                }
-          }
-      return null; 
-      }
-   Xml = ReplaceEntities(fr?Xml.slice(fr):Xml); 
-   Xml = Xml.replace(/\<\!\-\-([^\-]|\-[^\-]|\-+[^\-\>])*\-{2,}\>/g,"");  
-   fr = 0;
-   }
-return Xml.slice(fr); 
-}
-// -----------------------------------------------------------------------------------------------------------
-// Parses only <IO> tag from XML
-TGP.AddDataIO = function(Xml){
-if(!Xml) return;
-this.IO = {}; 
-
-MS.JsonIn;
-if(typeof(Xml)=="object"){
-   var X = Xml.IO;
-   if(!X || typeof(X)!="object") return;
-   this.IO = X; 
-   return;
-   }
-ME.JsonIn;
-   
-MS.XmlIn;
-var A = Xml.match(/\<IO(\s+\w+\s*\=\s*(\'[^\']*\'|\"[^\"]*\"))*\s*\/?\>/g);
-if(!A) return;
-var B = A[0].match(CNodeAttrsRegExp);
-this.SetNodeAttrs(this.IO,B);
-ME.XmlIn;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Main function for loading XML to grid. Parses Xml in string and add it to grid. DataIO is data source just for debug prints
-TGP.AddDataFromSource = function(Xml, DataIO){
-if(!Xml) return false;
-
-this.IO = {}; 
-this.AllCols = 0;
-if(typeof(Xml)=="object") { MS.JsonIn; if(!this.AddDataFromJson(Xml,DataIO)) return false; ME.JsonIn; }
-else { MS.XmlIn; if(!this.AddDataFromXml(Xml,DataIO)) return false; ME.XmlIn; }
-if(this.Reset&&typeof(this.Reset)=="number"){
-   var r = this.Reset, R = {}; this.Reset = R;
-   if(r&1) { R.Style = this.Style; R.CSS = this.CSS; R.DialogCSS = this.DialogCSS; }
-   if(r&2) { R.GanttStyle = this.GanttStyle; R.GanttCSS = this.GanttCSS; }
-   if(r&4) { R.Language = this.Language; }
-   }
-
-// --- IO Session ---
-if(this.IO.Session!=null) this.SetSession(this.IO.Session);  
-
-// --- Bonus ---
-if(DataIO && DataIO.Bonus){
-   MS.Debug; 
-   this.Debug(4,"Loading XML data from ",DataIO.Name+"_Bonus");
-   if(DataIO.Debug["in"]) this.DebugData(DataIO,DataIO.Bonus,"a bonus XML added:"); 
-   ME.Debug;
-   var B = {Name:DataIO.Name, Debug:DataIO.Debug, Bonus:""};
-   this.AddDataFromSource(this.PrepareData(DataIO.Bonus,B),B);
-   }
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-// For API only, returns true for ok, false for error
-MS.Api;
-TGP.AddDataFromServer = function(xml,DataIO){
-var prep = this.PrepareData(xml,DataIO?DataIO:{ });
-if(!prep) return false;
-this.AddDataFromSource(prep,DataIO?DataIO:{ }); 
-this.Update();
-return true;
-}
-ME.Api;
-// -----------------------------------------------------------------------------------------------------------
-// Sets Session to session and saves it
-TGP.SetSession = function(session){
-if(session=="") session = null;
-this.Source.Session = session;
-if(session==null) session = "";
-if(this.SaveSession==1 && Grids.SetCfg) Grids.SetCfg(this.id+"&"+(this.SessionId?this.SessionId:"Session"),session?escape(session):"");
-else { 
-   var sid = this.SaveSession ? this.SaveSession : this.id+"_"+(this.SessionId?this.SessionId:"Session");
-   var E = GetElem(sid);
-   if(!E) {
-      E = document.createElement("input");
-      E.type = "hidden";
-      E.id = sid;
-      AppendTag(E);
-      }
-   E.value = session;
-   }
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.UpdateLangFormat = function(){ return this.Lang.Format.Init(); }
-// -----------------------------------------------------------------------------------------------------------
-TGP.MoveColData = function(C,next,sec){
-var CX = this.ColNames[C.Sec];
-for(var i=C.Pos+1;i<CX.length;i++) this.Cols[CX[i]].Pos--;
-CX.splice(C.Pos,1);
-if(next){
-   var N = this.Cols[next];
-   C.Pos = N.Pos; C.Sec = N.Sec;
-   CX = this.ColNames[N.Sec];
-   CX.splice(C.Pos,0,C.Name);
-   for(var i=C.Pos+1;i<CX.length;i++) this.Cols[CX[i]].Pos++;
-   }
-else { 
-   CX = this.ColNames[sec!=null?sec:C.Sec];
-   C.Pos = CX.length; 
-   CX[CX.length] = C.Name; 
-   }
-}
-// -----------------------------------------------------------------------------------------------------------
diff --git a/Grid/DataOut.js b/Grid/DataOut.js
index e15e200..4290e0e 100644
--- a/Grid/DataOut.js
+++ b/Grid/DataOut.js
@@ -110,7 +110,6 @@
    var v = alldef&1 ? Get(row,c) : row[c]; 
    if(row[c+"_Link"]!=undefined) v=row[c+"_Link"];//***增加处理只读超链接时需要取原始值而不是表面的值
    if(row[c+"_Img"]!=undefined) v=row[c+"_Img"];//***增加处理图片时需要取原始值而不是表面的值
-   if(row[c+"_Orig46"]!=undefined) v=row[c+"_Orig46"];//***增加处理46控件时需要取原始值而不是表面的值
 	if(row[c+"_expr_val"]!=undefined) v=row[c+"_expr_val"];
    if(v==null) v = "";
   
@@ -302,8 +301,19 @@
                          	row[c+"Orig"]=row[c+"_Img"];
                          	
              }
+             //****46控件 */
+             if(this.Cols[c].colType!=undefined&&this.Cols[c].colType==46&& row[c+"_Orig46"]!=undefined){
+               row[c+"Orig"]=row[c+"_Orig46"];
+             }
          	 	 SetAttr(row,c+"Orig");
          	 }else{
+                  //****46控件 */
+             if(this.Cols[c].colType!=undefined&&this.Cols[c].colType==46&& row[c+"_Orig46"]!=undefined){
+                         	if(row[c]==""){
+                               //*****不修改原值,但又需要把它提交到后台
+                              row[c]=row[c+"_Orig46"];
+                            }
+             } 
          	 	SetAttr(row,c);
          	}
          	   if(this.Cols[c].audit&&row[c + "Orig"] != undefined){
diff --git a/Grid/DataOut.js.bak b/Grid/DataOut.js.bak
deleted file mode 100644
index 86ad0df..0000000
--- a/Grid/DataOut.js.bak
+++ /dev/null
@@ -1,1569 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// Functions for generating output XML
-// -----------------------------------------------------------------------------------------------------------
-var CRowAttrs = { HasIndex:1, Level:1, LevelImg:1, Hasch:1, State:1, Focused:1, CalcOrderAuto:1, Filtered:1, ExpandCol:1 } 
-
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetUploadFormat = function(src){
-var f = src.Format.toLowerCase(), F = { };
-F.Dtd = f=="dtd"; F.Json = f=="json"; 
-F.Json2 = f=="json"; 
-F.Sep = F.Json ? "\":" : "="; F.Spc = F.Json ? ",\"" : " "; F.Spc1 = F.Json?"\"":" "; F.One = F.Json ? "\":1" : "=\"1\"";
-F.Str = F.Json ? (src.Xml==2?StringToJsonX:StringToJson) : StringToXml;
-F.Start = F.Json ? "{\"id\":\"" : "<I id=\""; F.End = F.Json ? "}," : "/>";
-return F;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns next not deleted row
-MS.Cfg$Upload;
-TGP.NextChanges = function(row){
-var r = row.nextSibling;
-while(r && r.Deleted) r = r.nextSibling;
-return r;
-}
-ME.Cfg$Upload;
-// -----------------------------------------------------------------------------------------------------------
-// Returns previous not deleted row
-MS.Cfg$Upload;
-TGP.PrevChanges = function(row){
-var r = row.previousSibling;
-while(r && r.Deleted) r = r.previousSibling;
-return r;
-}
-ME.Cfg$Upload;
-// -----------------------------------------------------------------------------------------------------------
-// Returns string with row changes for cookies
-MS.Cfg;
-TGP.GetRowChangesCfg = function(row){
-var S = "", C = this.Cols;
-if(row.Deleted) S = "D";
-else if(row.Added){
-   var def = row.Def, par = row.parentNode, next = this.NextChanges(row), prev = this.PrevChanges(row), ppar = Get(row,"Par");
-   S = "A&"+(ppar?ppar:"")+"&"+def.Name+"&" + (par.id ? par.id : par.Pos!=null ? par.Pos : "") + "&" + (next && next.id ? next.id : "") + "&"+(row.Copy?row.Copy:"");
-   for(var c in C){
-      if(row[c]!=null && row[c]!=def[c] && (!C[c].Formula && (!row.Calculated || !row[c+"Formula"])||this.CalculateChanges) && typeof(row[c])!="function"){ 
-         S += "&"+c+"&"+escape(row[c]);
-         }
-      }
-   }
-else if(row.Changed || row.Moved){
-   if(row.Changed) S = "C";
-   if(row.Moved){ 
-      var par = row.parentNode, next = this.NextChanges(row), prev = this.PrevChanges(row);
-      S = "M&"+row.Moved+"&" + (par.id ? par.id : par.Pos!=null ? par.Pos : "") + "&" + (next && next.id ? next.id : "") + "'";
-      }
-   if(row.Changed){ 
-      if(row.Cells) {
-         for(var i=0;i<row.Cells.length;i++) if(row[row.Cells[i]+"Changed"]) S += "&"+c+"&"+escape(row[row.Cells[i]]);
-         }
-      else { 
-         for(var c in C) if(row[c+"Changed"]) S += "&"+c+"&"+escape(row[c]);
-         }
-      }
-   }
-return S;
-}
-ME.Cfg;
-// -----------------------------------------------------------------------------------------------------------
-// Converts value date according to DateStrings
-TGP.ConvertUpload = function(row,col,val,fed){//****增加全匹配,日期类型字段Orig结尾的处理,因为这个字段没有类型的,需要做以下的处理
-MS.Date;
-if(this.DateStrings && this.GetType(row,col)=="Date"||(col!=undefined&&col.indexOf("Orig")>0&&this.GetType(row,col.replace("Orig",""))=="Date")){ 
-   if(!val&&val!="0") return ""; 
-   MS.Hirji;
-   var hir = this.Lang.Format.Hirji;
-   if(hir){
-      if(hir==1) this.Lang.Format.Hirji = 0;
-      if(hir==2) this.Lang.Format.Hirji = 1;
-      }
-   ME.Hirji;      
-   var D = this.Lang.Format.DateToString(val,this.DateStrings==2?"yyyy-MM-dd HH:mm:ss":(this.DateStrings==1?null:this.DateStrings),this.IsRange(row,col));
-   MS.Hirji;
-   if(hir) this.Lang.Format.Hirji = hir;
-   ME.Hirji;
-   return D;
-   }
-ME.Date;
-if(fed==1 && row[col+"EFormula"]) {
-   val = this.Lang.Format.FormulaPrefix+row[col+"EFormula"];
-   if(this.FormulaRelative==2) val = this.ConvertEditFormula(row,col,val,this.FormulaLocal ? 6 : 4);
-   }
-return val;
-}
-
-// -----------------------------------------------------------------------------------------------------------
-MS.Upload;
-// -----------------------------------------------------------------------------------------------------------
-// Returns string with row changes
-// F is object with format settings
-// type = &1 - changes, &2 - selected, &4 - resized
-// For alldef&1 returns for added rows also values from defaults
-// For alldef&2 returns also calculated values
-TGP.GetRowChanges = function(row,F,type,alldef,attrs){
-if(Is(row,"NoUpload") && !(alldef&32)) return "";
-var S = "", C = this.Cols, T = this, X = { id:1,Added:1,Deleted:1,Changed:1,Moved:1,Parent:1,Next:1,Prev:1,Par:1,Selected:1,Copy:1,Resized:1,Height:1 }, fed = alldef&16 ? 0 : this.FormulaEditing;
-       var isaudit=false;//****增加审计功能 by 2014-3-12
-       var au="";//
-function SetAttr(row,c){ 
-   if(X[c]) return;
-   X[c] = 1;
-   var v = alldef&1 ? Get(row,c) : row[c]; 
-   if(row[c+"_Link"]!=undefined) v=row[c+"_Link"];//***增加处理只读超链接时需要取原始值而不是表面的值
-   if(row[c+"_Img"]!=undefined) v=row[c+"_Img"];//***增加处理图片时需要取原始值而不是表面的值
-   if(row[c+"_Orig46"]!=undefined) v=row[c+"_Orig46"];//***增加处理46控件时需要取原始值而不是表面的值
-	if(row[c+"_expr_val"]!=undefined) v=row[c+"_expr_val"];
-   if(v==null) v = "";
-  
-   v = T.ConvertUpload(row,c,v,fed);
-   if(F.Dtd) S += "<U N=\""+c+"\" V=\""+F.Str(v)+"\"/>";
-   else S += F.Spc+c+F.Sep+"\""+F.Str(v)+"\"";
-   }
-
-function GetAttrs(row){
-   if(!attrs) return "";
-   var S = "";
-   for(var i=0;i<attrs.length;i++){
-      var c = attrs[i], v = alldef&1 ? Get(row,c) : row[c]; 
-      if(v==null || X[c]) continue;
-      if(typeof(v)=="object"){ if(c=="Def") v = v.Name; else continue; }
-      X[c] = 1;
-      if(T.FormulaEditing==2 && T.FormulaRelative==2){
-         var idx = c.indexOf("EFormula");
-         if(idx>=0 && C[c.slice(0,idx)]) v = T.ConvertEditFormula(row,c.slice(0,idx),v,T.FormulaLocal ? 6 : 4);
-         }
-      S += F.Spc+c+F.Sep+"\""+F.Str(v)+"\"";
-      }
-   return S;   
-   }   
-
-function SetSpan(r){
-   if(r.Spanned) for(var col in C) if((r[col+"Span"]>1||r[col+"SpanOrig"]>1) && r[col+"Span"]!=r[col+"SpanOrig"] && r[col+"RowSpan"]!=0 && r[col+"Visible"]!=-2) SetAttr(r,col+"Span");
-   if(r.RowSpan) for(var col in T.SpanCols) if((r[col+"RowSpan"]>1||r[col+"RowSpanOrig"]>1) && r[col+"RowSpan"]!=r[col+"RowSpanOrig"] && r[col+"Span"]!=0) SetAttr(r,col+"RowSpan");
-   }
-  function getAudit1(y){//*****by danaus 2014-3-25,取得审计设置为1的字段的值,组装作为以后查询的条件,GT_tranCode function是作为处理双引号
-    	var result="";
-    	 for(var A in C) {
-    	 	if(C[A].audit==1) {
-    	 		result+=","+GT_tranCode(y[A])+((y[A+"Orig"]!=undefined&&y[A+"Orig"]!="")?","+GT_tranCode(y[A+"Orig"]):"");
-    	 	}
-    	 	
-    	}
-    	return result+=",";
-    };
-if(row.Deleted) {
-   S = F.Start+F.Str(row.id)+"\""+F.Spc+"Deleted"+F.One+(row.Added?F.Spc+"Added"+F.One:"")+GetAttrs(row);
-   if(F.Dtd) S += ">";
-  //** if(alldef&2) for(var c in C) if(!C[c].NoUpload) SetAttr(row,c); 去掉
- for(var c in C){
-  // if(!C[c].NoUpload){//***** 去掉
-   	 if(row[c+"_Img"]!=undefined){
-            row[c+"Orig"]=row[c+"_Img"];
-             }
-         if(row[c+"_Link"]!=undefined){
-            row[c+"Orig"]=row[c+"_Link"];
-             }
-	if(row[c+ "Orig"]!=undefined) row[c]=row[c+ "Orig"];//增加处理删除前修改了内容的情况,需要把原值返原处理 by 12-11-26
-   	 SetAttr(row,c);
-   	 //****delete 
-   if(this.Cols[c].audit==2||this.Cols[c].audit==1){//****删除的情况下,只需要处理为2的情况,只是把所有为1的作为值加进去就可以了
-var aus="";
-                	if(row[c]==undefined||row[c]=="") continue;
-if(this.Cols[c]!=undefined&&this.Cols[c].Type=="Date"){
-                		//处理日期数值返回给面板时候,需要格式化成日期显示,因为格线内部是用毫秒表示 by2014-6-24
-                	if(row[c]!=undefined)  row[c]= DateToString(row[c],this.Cols[c].Format);
-                	if(row[c+ "Orig"]!=undefined)  row[c+ "Orig"]= DateToString(row[c+ "Orig"],this.Cols[c].Format);
-                	}
-                		var oldValue=row[c];
-                	if(oldValue!=undefined&&oldValue!=""){
-                		oldValue=(oldValue+"").replace(/\\/g, '\\\\');
-                	}
-                	var newValue=row[c+ "Orig"];
-                	if(newValue!=undefined&&newValue!=""){
-                		newValue=(newValue+"").replace(/\\/g, '\\\\');
-                	}
-                	var Header=this.Header[c];
-                	if(Header!=undefined&&Header!=""){
-                		Header=(Header+"").replace(/\\/g, '\\\\');
-                	}
-                	if(au==""){
-                	  aus='{"newvalue":"'+GT_tranCode(newValue,true)+'","oldvalue":"'+GT_tranCode(oldValue,true)+ '","Fielddescr":"' + GT_tranCode(Header,true)+'","fieldname":"'+c+'","usercode":"","username":"","auditType":"delete","_YCAUDIT_":"1","formid":"'+this.formid+'","doccode":"'+(row["doccode"]==undefined?'':row["doccode"])+'","auditIndex":"'+getAudit1(row)+'"}';   
-                	}else{
-                	aus=',{"newvalue":"'+GT_tranCode(newValue,true)+'","oldvalue":"'+GT_tranCode(oldValue,true)+ '","Fielddescr":"' + GT_tranCode(Header,true)+'","fieldname":"'+c+'","usercode":"","username":"","auditType":"delete","_YCAUDIT_":"1","formid":"'+this.formid+'","doccode":"'+(row["doccode"]==undefined?'':row["doccode"])+'","auditIndex":"'+getAudit1(row)+'"}';
-                	}
-          	 isaudit=true;
-          	 au+=aus;
-}
- // }
-   }
-   S += F.Dtd ? "</I>" : F.End;
-       if(isaudit) S+=au+",";//****把需要审计的加到另一个新行,类型是_YCAUDIT_
-   }
-else if(row.Added || row.Moved==2&&alldef&8){
-   var def = row.Def, par = row.parentNode, next = this.NextChanges(row), prev = this.PrevChanges(row), ppar = Get(row,"Par");
-//*** 不需要太多参数传递
-//  S = F.Start+F.Str(row.id)+"\""+F.Spc+"Added"+F.One+(ppar?F.Spc+"Par"+F.Sep+"\""+ppar+"\"":"")+F.Spc+"Def"+F.Sep+"\""+def.Name
-//    + "\""+F.Spc+"Parent"+F.Sep+"\"" + (par.id ? F.Str(par.id) : par.Pos!=null ? par.Pos : "") 
-//    + "\""+F.Spc+"Next"+F.Sep+"\"" + (next && next.id ? F.Str(next.id) : "")
-//    + "\""+F.Spc+"Prev"+F.Sep+"\"" + (prev && prev.id ? F.Str(prev.id) : "")
-//     + "\"";
-//   if(type&2 && row.Selected) S += F.Spc+"Selected"+F.Sep+"\""+row.Selected+"\"";
-//   if(type&4 && row.Resized) S += F.Spc+"Height"+F.Sep+"\""+row.Height+"\"";
-//  if(row.Copy) S += F.Spc+"Copy"+F.Sep+"\""+row.Copy+"\"";
-   S = F.Start+F.Str(row.id)+"\""+F.Spc+"Added"+F.One;//**不需要太多参数传递 by 11-4-18
-   X.Def = 1; //*** TODO 不清楚保留最新这个有没影响,在这里做个标记,暂时保留
-   S += GetAttrs(row);
-   if(F.Dtd) S += ">";
-   
-   MS.GenId;
-   if(this.IdMore){
-      for(var i=0;i<this.IdMore;i++){
-         var n = this.IdNames[i];
-         if(row[n]==null) row[n]=def[n];
-         if(n!="Def") SetAttr(row,n);
-         }
-      }
-   ME.GenId;
-   if(type&2 && row.Selected&2) { for(var c in C) if(row[c+"Selected"]) SetAttr(row,c+"Selected"); }
-   for(var c in C){
-      if(!C[c].NoUpload && (alldef&2 || (alldef&1 || row[c]!=null && (row[c]!=def[c]||!def[c])) && !this.IdTypes[c] && (!C[c].Formula && (!row.Calculated || !row[c+"Formula"]) || this.CalculatedChanges&&(this.CalculatedChanges-0||this.CalculatedChanges[c])))){
-          //增加处理Bool类型值为0时,转为null,广陶需要这样处理
-   //if(C[c]!=undefined&&C[c].Type!=undefined&&C[c].Type=="Bool"){
-   	//if(row[c]=="0") row[c]="";
-  	//		}
-         SetAttr(row,c);
-           if(this.Cols[c].audit==2){//*******add 审计
-                	var aus="";
-                	if(row[c]==undefined||row[c]=="") continue;
-                	if(this.Cols[c]!=undefined&&this.Cols[c].Type=="Date"){
-                		//处理日期数值返回给面板时候,需要格式化成日期显示,因为格线内部是用毫秒表示 by2014-6-24
-                	if(row[c]!=undefined)  row[c]= DateToString(row[c],this.Cols[c].Format);
-                	if(row[c+ "Orig"]!=undefined)  row[c+ "Orig"]= DateToString(row[c+ "Orig"],this.Cols[c].Format);
-                	}
-                	var newValue=row[c];
-                	if(newValue!=undefined&&newValue!=""){
-                		newValue=(newValue+"").replace(/\\/g, '\\\\');
-                	}
-                	if(au==""){
-                	  aus='{"oldvalue":"'+GT_tranCode(row[c+ "Orig"],true)+'","newvalue":"'+GT_tranCode(newValue,true)+ '","Fielddescr":"' +GT_tranCode( this.Header[c],true)+'","fieldname":"'+c+'","usercode":"","username":"","auditType":"add","_YCAUDIT_":"1","formid":"'+this.formid+'","doccode":"'+(row["doccode"]==undefined?'':row["doccode"])+'","auditIndex":"'+getAudit1(row)+'"}';  
-                	}else{
-                	aus=',{"oldvalue":"'+GT_tranCode(row[c+ "Orig"],true)+'","newvalue":"'+GT_tranCode(newValue,true)+ '","Fielddescr":"' +GT_tranCode( this.Header[c],true)+'","fieldname":"'+c+'","usercode":"","username":"","auditType":"add","_YCAUDIT_":"1","formid":"'+this.formid+'","doccode":"'+(row["doccode"]==undefined?'':row["doccode"])+'","auditIndex":"'+getAudit1(row)+'"}';
-                	}
-          	 isaudit=true;
-          	 au+=aus;
-          	}
-         }
-      }
-   if(this.SaveSpan) SetSpan(row);
-   S += F.Dtd ? "</I>" : F.End;
-   if(isaudit) S+=au+",";//****把需要审计的加到另一个新行,类型是_YCAUDIT_
-   }
-else if(row.Changed || row.Moved){
-   S = F.Start+F.Str(row.id)+"\"";
-   MS.GenId;
-   var CH = null;
-   if(alldef&4 && this.IdMore) {
-      CH = this.UpdateNewId(row,"NewId",0,row.Changed,row.Moved); 
-      if(row.NewId) S += F.Spc+"NewId"+F.Sep+"\""+row.NewId+"\"";
-      }
-   ME.GenId;
-   if(row.Changed) S += F.Spc+"Changed"+F.One;
-   if(row.Moved){ 
-      var par = row.parentNode, next = this.NextChanges(row), prev = this.PrevChanges(row);
-      S += F.Spc+"Moved"+F.Sep+"\""+row.Moved+"\""+F.Spc+"Parent"+F.Sep+"\"" 
-        + (par.id ? F.Str(par.id) : par.Pos!=null ? par.Pos : "") 
-        + "\""+F.Spc+"Next"+F.Sep+"\"" + (next && next.id ? F.Str(next.id) : "") 
-        + "\""+F.Spc+"Prev"+F.Sep+"\"" + (prev && prev.id ? F.Str(prev.id) : "")
-        + "\"";
-      }
-   if(type&2 && row.Selected) S += F.Spc+"Selected"+F.Sep+"\""+row.Selected+"\"";
-   if(type&4 && row.Resized) S += F.Spc+"Height"+F.Sep+"\""+row.Height+"\"";
-   S += GetAttrs(row);
-   if(F.Dtd) S += ">";
-   if(type&2 && row.Selected&2) { for(var c in C) if(row[c+"Selected"]) SetAttr(row,c+"Selected"); }
-   if(row.Changed || alldef&2){ 
-      if(row.Cells) {
-         for(var i=0;i<row.Cells.length;i++){
-         	 if(row[row.Cells[i]+"Changed"] || alldef&2){
-         	 	 SetAttr(row,row.Cells[i]);
-         	 	 SetAttr(row,row.Cells[i]+"Orig");//****
-         	 }else{
-         	 	 SetAttr(row,row.Cells[i]);
-         	}
-         }
-         }
-      else { 
-	 for(var c in C){
-         	 if(row[c+"Changed"] || alldef&2&& !C[c].NoUpload){
-         	 	 SetAttr(row,c);
-         	 	 if(this.Cols[c].couter=="Img"&& row[c+"_Img"]!=undefined){
-                         	row[c+"Orig"]=row[c+"_Img"];
-                         	
-             }
-         	 	 SetAttr(row,c+"Orig");
-         	 }else{
-         	 	SetAttr(row,c);
-         	}
-         	   if(this.Cols[c].audit&&row[c + "Orig"] != undefined){
-         	   	    if(this.Cols[c]!=undefined&&this.Cols[c].Type=="Date"){
-                		//***处理日期数值返回给面板时候,需要格式化成日期显示,因为格线内部是用毫秒表示 by2014-6-24
-                  if(row[c]!=undefined)  row[c]= DateToString(row[c],this.Cols[c].Format);
-                	if(row[c+ "Orig"]!=undefined)  row[c+ "Orig"]= DateToString(row[c+ "Orig"],this.Cols[c].Format);
-                	}
-                	var aus="";
-                	var newValue=row[c];
-                	if(newValue!=undefined&&newValue!=""){
-                		newValue=(newValue+"").replace(/\\/g, '\\\\');
-                	}
-                	var oldValue=row[c+ "Orig"];
-                	if(oldValue!=undefined&&oldValue!=""){
-                		oldValue=(oldValue+"").replace(/\\/g, '\\\\');
-                	}
-                	var Header=this.Header[c];
-                	if(Header!=undefined&&Header!=""){
-                		Header=(Header+"").replace(/\\/g, '\\\\');
-                	}
-                	if(au==""){
-                	  aus='{"oldvalue":"'+GT_tranCode(oldValue,true)+'","newvalue":"'+GT_tranCode(newValue,true)+ '","Fielddescr":"' + GT_tranCode(Header,true)+'","fieldname":"'+c+'","usercode":"","username":"","auditType":"update","_YCAUDIT_":"1","formid":"'+this.formid+'","doccode":"'+(row["doccode"]==undefined?'':row["doccode"])+'","auditIndex":"'+getAudit1(row)+'"}';
-                	}else{
-                	aus=',{"oldvalue":"'+GT_tranCode(oldValue,true)+'","newvalue":"'+GT_tranCode(newValue,true)+ '","Fielddescr":"' + GT_tranCode(Header,true)+'","fieldname":"'+c+'","usercode":"","username":"","auditType":"update","_YCAUDIT_":"1","formid":"'+this.formid+'","doccode":"'+(row["doccode"]==undefined?'':row["doccode"])+'","auditIndex":"'+getAudit1(row)+'"}';
-                	}
-          	 isaudit=true;
-          	 au+=aus;
-          	} 
-         }
-	 }
-         }
-      
-   if(this.IdMore && row[this.IdCol+"Changed"] && !this.Cols[this.IdCol]) SetAttr(row,this.IdCol);
-   if(this.SaveSpan) SetSpan(row);
-   S += F.Dtd ? "</I>" : F.End;
-   if(isaudit) S+=au+",";//****把需要审计的加到另一个新行,类型是_YCAUDIT_
-   MS.GenId; if(CH) for(var id in CH) S += F.Start+F.Str(id)+"\""+F.Spc+"NewId"+F.Sep+"\""+CH[id]+"\""+F.End; ME.GenId; 
-   }
-else if(type&2 && row.Selected || type&4 && row.Resized) {
-   S = F.Start+F.Str(row.id)+"\"";
-   if(type&2 && row.Selected) S += F.Spc+"Selected"+F.Sep+"\""+row.Selected+"\"";
-   if(type&4 && row.Resized) S += F.Spc+"Height"+F.Sep+"\""+row.Height+"\"";
-   S += GetAttrs(row);
-   if(F.Dtd) S += ">";
-   if(type&2 && row.Selected&2) { for(var c in C) if(row[c+"Selected"]) SetAttr(row,c+"Selected"); }
-   if(alldef&2) for(var c in C) if(!C[c].NoUpload) SetAttr(row,c);
-   }else if(this.cp&&row.Kind=="Data"&&row.id!="Fix1"){//***复单时候需要把这些数据作为新增 只有是data的行和不是统计行
-   	 var def = row.Def, par = row.parentNode, next = this.NextChanges(row), prev = this.PrevChanges(row), ppar = Get(row,"Par");
-   S = F.Start+F.Str(row.id)+"\""+F.Spc+"Added"+F.One;//**不需要太多参数传递 by 11-4-18
-   S += GetAttrs(row);
-   if(F.Dtd) S+=">";
-   MS.GenId;
-   if(this.IdMore){
-      for(var i=0;i<this.IdMore;i++){
-         var n = this.IdNames[i];
-         if(row[n]==null) row[n]=def[n];
-         if(n!="Def") SetAttr(row,n);
-         }
-      }
-   ME.GenId;
-   for(var c in C){
-      if(alldef&2 || (alldef&1 || row[c]!=null && (row[c]!=def[c]||!def[c])) && !this.IdTypes[c] && (!C[c].Formula && (!row.Calculated || !row[c+"Formula"])) && C[c].Type!="Gantt" && c!="_ConstWidth"){
-         SetAttr(row,c);
-         }
-      }
-   if(this.SaveSpan) SetSpan(row);
-   S += F.Dtd ? "</I>" : F.End;
-   }else if(this.btnId!=""&&row.Kind=="Data"&&row.id!="Fix1"){//***点OA按钮时需要把当前格线数据提交到后台 则只有是data的行且不是统计行
-   	 var def = row.Def, par = row.parentNode, next = this.NextChanges(row), prev = this.PrevChanges(row), ppar = Get(row,"Par");
-   S = F.Start+F.Str(row.id)+"\""+F.Spc+"OAChanged"+F.One;//**不需要太多参数传递 by 11-4-18
-   S += GetAttrs(row);
-   if(F.Dtd) S+=">";
-   MS.GenId;
-   if(this.IdMore){
-      for(var i=0;i<this.IdMore;i++){
-         var n = this.IdNames[i];
-         if(row[n]==null) row[n]=def[n];
-         if(n!="Def") SetAttr(row,n);
-         }
-      }
-   ME.GenId;
-   for(var c in C){
-      if(alldef&2 || (alldef&1 || row[c]!=null && (row[c]!=def[c]||!def[c])) && !this.IdTypes[c] && (!C[c].Formula && (!row.Calculated || !row[c+"Formula"])) && C[c].Type!="Gantt" && c!="_ConstWidth"){
-         SetAttr(row,c);
-         }
-      }
-   if(this.SaveSpan) SetSpan(row);
-   S += F.Dtd ? "</I>" : F.End;
-   }
-else if(this.SaveSpan) {
-   SetSpan(row);
-   if(S) S = F.Start + F.Str(row.id) + "\"" + F.Spc + "Changed" + F.One + (F.Dtd?">":"") + S + (F.Dtd?"</I>":F.End);
-   }
-return S;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns changes of variable rows - recursion
-TGP.GetChildrenChanges = function(row,F,type,alldef,attrs){
-var A = [], p = 0;
-for(var r=row.firstChild;r;r=r.nextSibling){ 
-   A[p] = this.GetRowChanges(r,F,type,alldef,attrs); if(A[p]) p++;
-   var D = this; if(r.DetailCol){
-      for(var rr=r;rr.DetailRow;rr=rr.DetailRow[0]) if(rr.DetailGrid) D = rr.DetailGrid[0];
-      }
-   A[p] = D.GetChildrenChanges(r,F,type,alldef,attrs);
-   
-   if(A[p]) p++;
-   }
-return A.join("");
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns what changes grid contains (&1 changes, &2 selected rows)
-TGP.HasChanges = function(row){
-var ret = 0,max = (this.Resizing?4:0)+(this.Selecting?2:0)+1;
-if(!row){
-   var F = this.GetFixedRows();
-   for(var i=0;i<F.length;i++) if(F[i].Kind!="Filter") ret |= this.HasChanges(F[i]);
-   for(var r=this.XS.firstChild;r;r=r.nextSibling) ret |= this.HasChanges(r);
-   for(var b=this.XB.firstChild;b&&ret!=max;b=b.nextSibling) for(var r=b.firstChild;r;r=r.nextSibling) ret |= this.HasChanges(r);
-   }
-else {
-   if(!Is(row,"NoUpload")){
-      if(row.Added || row.Deleted || row.Changed || row.Moved) ret|=1;
-      if(row.Selected&1) ret|=2;
-      if(row.Resized) ret|=4;
-      }
-   if(ret!=max) for(var r=row.firstChild;r;r=r.nextSibling) ret |= this.HasChanges(r);
-   }
-if(this.SaveHeights) ret&=~4;
-if(this.SaveSelected) ret&=~2;
-if(this.SaveValues) ret&=~1;
-return ret;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns data of changed rows in XML in string, without root tag, row tags only
-// If row is given, returns changes of this row only
-// If type is given, returns tag <changes> only, cannot be used with row
-// type = &1 - changess, &2 selected, &4 resized
-// For alldef&1 returns for added rows also values from defaults
-// For alldef&2 returns also calculated values
-TGP.GetChanges = function(row,type,alldef,attrs,F){
-if(!F) F = this.GetUploadFormat(this.Source.Upload);
-//*** 增加 this.Ps
-var gridstart = (F.Json?"{"+this.Ps+" \"IO\":{":"<Grid><IO")+(this.Source.Session!=null?F.Spc1+"Session"+F.Sep+"\""+this.Source.Session+"\"":"")+F.End;
-var gridend = F.Json ? "}" : "</Grid>", chgstart = F.Json ? "\"Changes\":[" :"<Changes>", chgend = F.Json ? "]" : "</Changes>";
-if(row) {
-   var chg = this.GetRowChanges(row,F,type,alldef,attrs); if(!chg) return "";
-   if(F.Json && chg.slice(-1)==',') chg = chg.slice(0,-1); 
-   return gridstart+chgstart + chg + chgend+gridend;
-   }
-if(this.SaveOrder) return (type?"":gridstart+chgstart) + this.GetChangesOrder() + (type?"":chgend+gridend);
-var A = [], p = 0;
-var R = this.GetFixedRows();
-for(var i=0;i<R.length;i++) if(R[i].Kind!="Filter"){ A[p] = this.GetRowChanges(R[i],F,type,alldef,attrs); if(A[p]) p++;}
-for(var r=this.XS.firstChild;r;r=r.nextSibling){ A[p] = this.GetRowChanges(r,F,type,alldef,attrs); if(A[p]) p++; }
-for(var b=this.XB.firstChild;b;b=b.nextSibling){ A[p] = this.GetChildrenChanges(b,F,type,alldef,attrs); if(A[p]) p++;}
-if(F.Json && p && A[p-1].slice(-1)==',') A[p-1] = A[p-1].slice(0,-1); 
-
-return (type?"":gridstart+chgstart) + A.join("") + (type?"":chgend+gridend);
-}
-// -----------------------------------------------------------------------------------------------------------
-// Clear all modification flags in rows and rerenders them, deletes rows marked Deleted
-// If row is given, updates this row only
-TGP.AcceptChanges = function(row,master){
-if(!row) { 
-   MS.Undo; 
-   if(this.Undo&32 && this.OUndo) { 
-      var OU = this.OUndo, p = OU.Pos;
-      if(p){
-         if(OU[p-1].Type=="End"){
-            if(OU[p-2].Type!="Accept"){ OU.splice(p-1,0,{Type:"Accept",Row:null}); OU.Pos++; }
-            }
-         else if(OU[p-1].Type!="Accept") { OU.splice(p-1,1,{Type:"Start"},OU[p-1],{Type:"Accept",Row:null},{Type:"End"}); OU.Pos+=3; }
-         }
-      
-      } 
-   
-   else if(!this.MasterGrid) this.ClearUndo(1); 
-   ME.Undo;
-   this.Changes = []; 
-   var F = this.GetFixedRows(),r,n,l;
-   for(r=0;r<F.length;r++) if(F[r].Kind!="Filter") this.AcceptChanges(F[r],1);
-   for(r=this.XS.firstChild;r;r=r.nextSibling) this.AcceptChanges(r,1);
-   for(r=this.GetFirst();r;){
-      if(r.Deleted){
-         n = r; l = r.Level;
-         r = this.GetNext(r);
-         if(l!=null) while (r && r.Level > l) r = this.GetNext(r); 
-         this.AcceptChanges(n,1);
-         }
-      else { 
-         this.AcceptChanges(r,1);
-         r = this.GetNext(r);
-         }
-      }
-   if(this.RefreshDetail) this.RefreshDetail();
-   MS.Pivot; if(this.PivotDetail) for(var id in this.PivotDetail) this.PivotDetail[id].AcceptChanges(null,1); ME.Pivot;
-
-   var C = this.Cols; 
-   for(var c in C) {
-      if(C[c].Deleted) this.DelCol(c);
-      else if(C[c].Added) { C[c].Added = 0; if(this.ColorState&4) this.ColorCol(c); }
-      }
-   this.SaveOrigData();
-   return;
-   }
-
-if(row.Deleted && Get(row,"NoUpload")!=2){ 
-   if(row==this.FRow) this.FRow = null;
-   this.DelRow(row);
-   }
-else if((row.Added || row.Changed || row.Moved) && Get(row,"NoUpload")!=2){
-   MS.GenId; if(this.IdMore) this.UpdateNewId(row,"id",this.SetIds,row.Changed,row.Moved); ME.GenId;
-     if(row.Changed){ 
-      var calcchg = this.CalculatedChanges; 
-        if(row.Cells){ 
-           for(var i=0;i<row.Cells.length;i++) if(row[row.Cells[i]+"Changed"]){ row[row.Cells[i]+"Changed"] = null; this.RefreshCell(row,row.Cells[i]); if(calcchg) row[row.Cells[i]+"Orig"] = row[row.Cells[i]]; }
-           }
-        else {
-           for(var c in this.Cols) if(row[c+"Changed"]){ row[c+"Changed"] = null; this.RefreshCell(row,c); if(calcchg) row[c+"Orig"] = row[c];  }
-           }
-        
-        }
-     if(this.IdMore && (row.Changed || row.Moved) && row[this.IdCol+"Changed"]) row[this.IdCol+"Changed"] = null;
-   MS.Gantt;
-   MS.GanttRun;
-   if(this.Gantt){
-      var col = this.GetFirstGantt(), C = this.Cols[col];
-      if(C && C.GanttRunStates&2 && this.Cols[C.GanttRun]){
-         var run = Get(row,C.GanttRun), chg = 0;
-         if(run){
-            var s1 = run.charCodeAt(0),s2 = ','; 
-            if(s1>=48&&s1<=57||s1==32||s1==45) s1 = ';';
-            else {
-               s1 = run.charAt(0);
-               s2 = run.charCodeAt(1);
-               if((s2>=48&&s2<=57||s2==45)&&s1!=32) { s2 = ','; run = run.slice(1); }
-               else { s2 = run.charAt(1); run = run.slice(2); }
-               }
-            if(s1=='['&&s2=='{'){ 
-               run = FromJSON("[{"+run);
-               if(typeof(run)!="string") {
-                  for(var i=0;i<run.length;i++){
-                     var ri = run[i];
-                     if(ri.State) {
-                        var s = C.GanttRunStates&4 ? ri.State&7 : ri.State.replace(/added|deleted|moved|resized|changed/g,"").replace(/\+[\+]+|^\+|\+$/g,""); 
-                        if(ri.State!=s){ chg = 1; if(s) ri.State = s; else delete ri.State; }
-                        }
-                     if(ri.Type=="-") { chg = 1; run.splice(i--,1); }
-                     }
-                  }
-               if(chg){
-                  for(var i=0;i<run.length;i++){
-                     var ri = run[i], s = "";
-                     for(var n in ri) s += n+":'"+((ri[n]+"").search(/[\\\']/)<0?ri[n]:ri[n].replace(/\\/g,"\\\\").replace(/\'/g,"\\'"))+"',";
-                     run[i] = s.slice(0,-1); 
-                     }
-                  row[C.GanttRun] = "[{"+run.join("},{")+"}]"; this.RefreshCell(row,C.GanttRun);
-                  }
-               }                     
-            else {  
-               run = run.split(s1);
-               for(var i=0;i<run.length;i++){
-                  var rr = run[i].split(s2);
-                  var hs = parseInt(rr[1])+1 ? 1 : 0;
-                  if(rr[7+hs]){ 
-                     var s = C.GanttRunStates&4 ? rr[7+hs]&7 : rr[7+hs].replace(/added|deleted|moved|resized|changed/g,"").replace(/\+[\+]+|^\+|\+$/g,""); 
-                     if(s!=rr[7+hs]){ 
-                        chg = 1; rr[7+hs] = s; 
-                        if(!s && rr.length==8+hs) { for(var j=6;j>=0&&!rr[j+hs]&&rr[j+hs]!="0";j--); rr.length = j+hs+1; }
-                        run[i] = rr.join(s2); 
-                        }
-                     }
-                  if(rr[1+hs]=="-") { chg = 1; run.splice(i--,1); }
-                  }
-               if(chg){ row[C.GanttRun] = (s1==';'&&s2==','?"":s1+s2)+run.join(s1); this.RefreshCell(row,C.GanttRun); }
-               }
-            }
-         }
-      }
-   ME.GanttRun;
-   ME.Gantt;
-   if(row.DetailRow) for(var i=0;i<row.DetailRow.length;i++) {
-      var r = row.DetailRow[i]; r.Added = row.Added; r.Changed = row.Changed; r.Moved = row.Moved; r.Copy = row.Copy; r.NewId = row.NewId;
-      row.DetailGrid[i].AcceptChanges(r);
-      }
-   row.Added = null; 
-   row.Changed = null;
-   row.Moved = null;
-   row.Copy = null;
-   row.NewId = null;
-   if(this.ColorState&3) this.ColorRow(row); 
-   
-   }
-
-if(this.SaveSpan){
-   if(row.Spanned){
-      for(var c in this.Cols) {
-         if(row[c+"SpanOrig"]) row[c+"SpanOrig"] = null;
-         if(row[c+"Span"]>1 && row[c+"RowSpan"]!=0) row[c+"SpanOrig"] = row[c+"Span"];
-         }
-      }
-   if(row.RowSpan){
-      for(var c in this.SpanCols) {
-         if(row[c+"RowSpanOrig"]) row[c+"RowSpanOrig"] = null;
-         if(row[c+"RowSpan"]>1 && row[c+"Span"]!=0) row[c+"RowSpanOrig"] = row[c+"RowSpan"];
-         }
-      }
-   }
-MS.Pivot; if(!master && this.PivotDetail) for(var id in this.PivotDetail) this.PivotDetail[id].AcceptChanges(row,1); ME.Pivot;
-if(!master && this.RefreshDetail) this.RefreshDetail();
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns all grid data
-// type = &7 = rows, 0 - none, 1 - changed, 2 - selected, 3 - selected + changed, 5 - all fixed, 6 - all variable, 7 - all
-// type&8 = configuration from cookies, &16 - Cfg, &32 - Def, &64 - Cols, &128 - Header, &256 - Panel+Toolbar+MenuCfg+Pager, &512 - Img
-// type&1024 = Lang, &0x10000 - no <Grid>, &0x20000 - no <IO>
-TGP.GetXmlData = function(type,attrs,colvis,U,row,rowvis){
-var flags = ""; if(!U) U = this.Source.Upload;
-if(type==null) { type = U.Type; flags = U.Flags; }
-var names, otype = type;
-MS.UploadType;
-MS.Debug; names = "changes,selected,resized,expanded,hidden,body,data,all,fixed,settings,config,configxlsx,cookie,cfg,def,cols,root,menu,actions,animations,pagers,resources,zoom,calendars,media,other,lang,languages,text,complete,defaults,allcols,nodelete,noio,nogrid,gantt,span,spanned,newid,accepted,index,nogantt,autocols,focus,editattrs,cells,noempty,focused,fullmoved,noformula,noupload"; ME.Debug;
-if(type && type-0+""==type) { 
-   var t = type&7;
-   type = this.BitArrayToFlags(type&~7,",,,settings,cfg,def,cols,,other,,lang,,cookie,,,,nogrid,noio");
-   if(t==3) { type["changed"] = 1; type["selected"] = 1; }
-   else type[["","changes","selected","","","","body","all"][t]] = 1;
-   }
-else {
-   if(type&&typeof(type)=="string"&&type.toLowerCase().indexOf("complete")>=0) type += ",all,cols,cfg,def,calendars,resources,zoom,other,lang,text";
-   type = this.ConvertFlags((type?type:(type==null?"changes":""))+(flags&&type!=""?",":"")+(flags?flags:""),names);
-   }
-ME.UploadType;
-if(attrs==null) attrs = U.Attrs;
-if(typeof(attrs)=="string") attrs = attrs.split(",");
-
-var C = this.Cols, rspn = 0, cspn = 0, noformula = type["noformula"], fed = noformula ? 0 : this.FormulaEditing;
-if(attrs) {
-   var A = [], p = 0;
-   for(var i=0;i<attrs.length;i++) {
-      if(attrs[i].charAt(0)=="*"){ 
-         var a = attrs[i].slice(1); 
-         if(a=="RowSpan") rspn = 1;
-         else if(a=="Span") cspn = 1;
-         for(var c in C) if(!C[c].NoUpload && (a||c!="id")) A[p++] = c+a;
-         }
-      else A[p++] = attrs[i];
-      }
-   attrs = A;
-   }
-if(type["editattrs"]) {
-   var A = this.GetEditAttrs(fed==2?3:1); if(!attrs) attrs = [];
-   if(A.RowSpan!=null) A.splice(A.RowSpan,1);
-   if(A.Span!=null) A.splice(A.Span-(A.RowSpan!=null&&A.Span>A.RowSpan?1:0),1);
-   A.push("Img","Link");
-   for(var i=0;i<A.length;i++) {
-      var a = A[i];
-      if(a=="RowSpan") rspn = 1;
-      else if(a=="Span") cspn = 1;
-      for(var c in C) if(!C[c].NoUpload && (a||c!="id")) attrs[attrs.length] = c+a;
-      }
-   }
-if(this.HasFiles){
-   U.Files = {};
-   for(var col in this.HasFiles){
-      var H = this.HasFiles[col];
-      for(var id in H){
-         var r = this.Rows[id];
-         if(r && r[col] && r[col+"Changed"]) {
-            for(var i=0,F=r[col];i<F.length;i++) U.Files[id+"$"+col+(i?"$"+i:"")] = r[col][i];
-//            r[col+"Zal"] = F; r[col] = ""; 
-            }
-         }
-      }
-   }
-else U.Files = null;
-if(!otype && !flags) return this.GetChanges(row,null,null,attrs); 
-
-MS.UploadType;
-if(row) return this.GetChanges(row,1+(type["selected"]?2:0)+(type["resized"]?4:0),(type["defaults"]?1:0)+(type["allcols"]?2:0)+(type["newid"]?4:0)+(type["fullmoved"]?8:0)+(noformula?16:0)+(type["noupload"]?32:0),attrs);
-
-var F = this.GetUploadFormat(U), O = type["cells"] ? this.OrigData : null, noempty = type["noempty"];
-var A = [], p = 0, T = this, pp;
-
-function GetAttr(n,v){
-   if(typeof(v)=="boolean") v=v?1:0;
-   else if(typeof(v)!="string" && typeof(v)!="number") return "";
-   if(n.charAt(0)=='_') { 
-      if(n.charAt(1)=='7'||n.search(/Formula|Enum/)<0) return "";   
-      n = n.slice(1); 
-      }
-   return F.Spc+n+F.Sep+"\""+F.Str(v)+"\"";
-   }
-
-function SetAttr(n,v){
-   if(accept && (n=="Added"||n=="Deleted"||n=="Moved"||n=="Changed"||n=="Parent"||n=="Next"||n=="Prev")) return;
-   if(typeof(v)=="boolean") v=v?1:0;
-   else if(typeof(v)!="string" && typeof(v)!="number") return;
-   if(n.charAt(0)=='_') { 
-      if(n.charAt(1)=='7'||n.search(/Formula|Enum/)<0) return;   
-      n = n.slice(1); 
-      }
-   A[p++] = F.Spc+n+F.Sep+"\""+F.Str(v)+"\"";
-   }
-
-function SetAttrs(nm,row,json2,reg){ 
-   var S = "";
-   if(reg) for(var n in row) { if(n.search(reg)==0) S += GetAttr(n,row[n]); }
-   else for(var n in row) S += GetAttr(n,row[n]); 
-   if(F.Json && S && S.charAt(0)==',') S = S.slice(1); 
-   A[p++] = "\n"+(json2?"{":(F.Json ? "\""+nm+"\":{" : "<"+nm))+S+F.End;
-   }
-
-function SetCustomAttrs(row){
-   if(!attrs) return;
-   var o = O ? O[row[ridx?ridx:"id"]] : null;
-   for(var i=0;i<attrs.length;i++) {
-      var n = attrs[i], v = row[n]; 
-      MS.RowSpan; if(rspn && row.RowSpan && n.indexOf("RowSpan")>=0 && (v=="0"||v==1) && C[n.replace("RowSpan","")]) continue; ME.RowSpan;
-      MS.ColSpan; if(cspn && row.Spanned && n.indexOf("Span")>=0 && (v=="0"||v==1) && C[n.replace("Span","")]) continue; ME.ColSpan;
-      if(v==null && alldef && row.Def) { v = row.Def[n]; if(!v&&v!="0"&&C[n]) v = null; }
-      var cn = n;
-      MS.Calc;
-      if(cidx){ 
-         if(!C[n]) { var c = GetColFromCell(n); if(c&&C[c]){ if(C[c].HasIndex) cn = cidx[c]+n.slice(c.length); else if(O&&C[c].Deleted) continue; } }
-         else if(C[n].HasIndex) cn = cidx[n];
-         else if(O&&C[n].Deleted) continue;
-         }
-      ME.Calc;
-      if(C[n]&&fed==1&&row[n+"EFormula"]!=null ? o&&row[n+"EFormula"]==o[n+"EFormula"] : o ? o[cn]==v||!v&&!o[cn]&&isNaN(v)&&isNaN(o[cn]) : v==null) continue;
-      
-      if(C[n]) v = T.ConvertUpload(row,n,v,fed);
-      if(v==null) v = "";
-      SetAttr(cn,v); 
-      }
-   }
-function SetRowAttrs(nm,row,reg){
-   if((accept||ridx) && row.Deleted) return;
-   A[p++] = F.Json ? "\n{" : "\n<"+nm;
-   var pp = p;
-   if(ridx&&row.HasIndex) SetAttr("id",row[ridx]);
-   else if(row.id) SetAttr("id",row.id);
-   if(row.Def && (row.Def.Name!="R"||alldef)) SetAttr("Def",row.Def.Name);
-   var cp = p, o = null;
-   if(O){
-      o = O[row[ridx?ridx:"id"]];
-      if(!ridx){
-         var rn = T.GetNextSibling(row), rp = T.GetPrevSibling(row), par = row.parentNode.Page?null:row.parentNode;
-         if((par?par.id:null)!=(o?o.parentNode:null)||(rn?rn.id:null)!=(o?o.nextSibling:null)||(rp?rp.id:null)!=(o?o.previousSibling:null)){
-            SetAttr("Moved",1); SetAttr("Parent",par?par.id:""); SetAttr("Next",rn?rn.id:""); SetAttr("Prev",rp?rp.id:"");
-            }
-         else if(!o) SetAttr("Added",1);
-         }
-      else if(o?row.Level!=o.Level:row.Level>0) SetAttr("Level",row.Level);
-      }
-   if(attrs||allcols) {
-      if(attrs) SetCustomAttrs(row); 
-      if(allcols) SetRowCols(row);
-      }
-   else {
-      var D = alldef ? null : row.Def;
-      for(var n in row) if(!RA[n]) {
-         var v = row[n]; if(D && (v===D[n]||CRowAttrs[n])) continue;
-         if(nogantt && n.indexOf(nogantt)==0 || ridx && n==ridx || noformula&&n.indexOf("EFormula")>0) continue;
-         MS.RowSpan; if(row.RowSpan && n.indexOf("RowSpan")>=0 && (v=="0"||v==1) && T.Cols[n.replace("RowSpan","")]) continue; ME.RowSpan; 
-         MS.ColSpan; if(row.Spanned && n.indexOf("Span")>=0 && (v=="0"||v==1) && T.Cols[n.replace("Span","")]) continue; ME.ColSpan; 
-         if(v==null && alldef && row.Def) v = row.Def[n];
-         var cn = n;
-         MS.Calc;
-         if(cidx){ 
-            if(!C[n]) { var c = GetColFromCell(n); if(c&&C[c]){ if(C[c].HasIndex) cn = cidx[c]+n.slice(c.length); else if(O&&C[c].Deleted) continue; } }
-            else if(C[n].HasIndex) cn = cidx[n];
-            else if(O&&C[n].Deleted) continue;
-            }
-         ME.Calc;
-         
-         if(o ? o[cn]==v || fed&&C[n]&&(fed==1?row[n+"EFormula"]&&row[n+"EFormula"]==o[cn+"EFormula"]:!v&&!o[cn]&&isNaN(v)&&isNaN(o[cn])) : v==null) continue;
-         if(C[n]) { if(C[n].Type!="Gantt") v = T.ConvertUpload(row,n,v,fed); }
-         else if(fed && (fed==1||T.FormulaRelative==2)){
-            var idx = n.indexOf("EFormula");
-            if(idx>0 && C[n.slice(0,idx)]){
-               if(fed==1) continue;
-               if(T.FormulaRelative==2) v = T.ConvertEditFormula(row,n.slice(0,idx),v,T.FormulaLocal ? 6 : 4);
-               }
-            }
-         if(!reg||cn.search(reg)==0&&cn!="RowSpan") { 
-            if(v==null) v = "";
-            SetAttr(cn,v); 
-            }
-         }
-      }
-   
-   if(F.Json) RemoveFirst(pp);
-   return cp!=p;
-   }
-
-function SetRowChildren(nm,row,reg){
-   if((accept||ridx) && row.Deleted) return;
-   var noup = Get(row,"NoUpload")-0 && !type["noupload"];
-   if(!noup){ 
-      var cp = p;
-      if(!SetRowAttrs(nm,row,reg)&&noempty&&(!row.firstChild||O)) { p = cp; A.length = p; }
-      else A[p++] = row.firstChild&&!O ? (F.Json?",\"Items\":[":">") : F.End; 
-      }
-   for(var r=row.firstChild;r;r=r.nextSibling) SetRowChildren(r.tagName,r,reg);
-   if(!noup && row.firstChild && !O) {
-      if(F.Json) RemoveLast();
-      A[p++] = F.Json?"]\n},":"\n</"+nm+">";
-      }
-   }
-
-function SetRowCols(row){
-var o = O ? O[row[ridx?ridx:"id"]] : null;
-for(var c in C){
-   if(c=="id" || C[c].NoUpload) continue;
-   var v = alldef&1 ? Get(row,c) : row[c]; 
-   if(v==null) v = "";
-   v = T.ConvertUpload(row,c,v,fed);
-   if(cidx && C[c].HasIndex) c = cidx[c];
-   if(o && (o[c]==v || o[c]==null&&v==="" || fed&&v&&row[c+"EFormula"]&&(v+"").slice(1)==o[c+"EFormula"])) continue;
-   A[p++] = F.Spc+c+F.Sep+"\""+F.Str(v)+"\"";
-   }
-}
-
-function GetAutoCols(){
-var cnt = 0; for(var c in C) if(C[c].HasIndex) cnt++;
-return GetAttr("AutoCols",cnt);
-}
-
-function RemoveLast() {
-   if(p && A[p-1] && A[p-1].slice(-1)==',') A[p-1] = A[p-1].slice(0,-1); 
-   }
-function RemoveFirst(pp) {   
-   if(A[pp] && A[pp].charAt(0)==',') A[pp] = A[pp].slice(1); 
-   }
-
-var RA = Grids.INames;
-if(!type["nogrid"]) A[p++] = F.Json ? "{" : "<Grid>";
-if(!type["noio"]) A[p++] = (F.Json?"\"IO\":{":"<IO")+(this.Source.Session!=null?F.Spc1+"Session"+F.Sep+"\""+this.Source.Session+"\"":"")+F.End;
-var alldef = type["defaults"]?1:0, accept = type["accepted"], allcols = type["allcols"]?2:0, nogantt = this.Gantt && type["nogantt"] ? this.GetFirstGantt() : null;
-var ridx = type["index"] ? this.RowIndex : null, rid = ridx?ridx:"id", cidx = type["index"] ? this.Rows[this.ColIndex] : null;
-
-var grp = this.Group && (type["cfg"]||type["settings"]) && (type["body"]||type["data"]||type["all"]) && this.Paging!=3;
-if(grp){ var zalgrp = this.Group; this.DoGrouping("",-1); this.Group = zalgrp; }
-if(this.Img.Width!=1){
-   if(type["cols"]) this.MultiplyScale(1/this.Img.Width,9);
-   if(type["other"]) this.MultiplyScale(1/this.Img.Width,10);
-   if(type["all"]||type["fixed"]) this.MultiplyScale(1/this.Img.SpaceWidth,12);
-   if(this.Gantt&&type["cols"]) this.MultiplyScale(1/this.Img.GanttWidth,24);
-   }
-if(type["cfg"]||type["body"]||type["data"]||type["all"]||type["fixed"]||type["other"]||type["cols"]||O){
-   var D = CDebugAttrs, B = CCellAttrs;
-   if(!D.Parsed){ for(var a in D) if(D[a]) D[a] = D[a].split(","); D.Parsed = 1; }
-   if(!B.Parsed){ for(var a in B) if(B[a]) B[a] = B[a].split(","); B.Parsed = 1; }
-   }
-
-// --- Gantt ---
-MS.Gantt;
-if(type["gantt"]){
-   var col = this.GetFirstGantt(); 
-   if(col){
-      var c = C[col], N = ["Base","Finish","Exclude","Include"];
-      if(type["settings"]||type["config"]||type["configxlsx"]) {
-         N = N.concat("HideExclude","ResourcesFilter","Zoom","ZoomDate","CorrectDependencies","CheckDependencies","Strict","BaseProof","BasePreferred","CheckExclude","CorrectDependenciesFixed");
-         c.GanttZoomDate = this.GetGanttADate(col);
-         }
-      A[p++] = F.Json ?"\n\"Gantt\":{" :"\n<Gantt"; pp = p;
-      for(var i=0;i<N.length;i++) {
-         var v = c["Gantt"+N[i]];
-         A[p++] = F.Spc+"Gantt"+N[i]+F.Sep+"\""+(v?v:"")+"\"";
-         if(i==1) v = this.IncLastUnit(v,c,-1,1);
-         if(i<2 && this.DateStrings) A[p++] = F.Spc+"Gantt"+N[i]+"Date"+F.Sep+"\""+(v?this.Lang.Format.DateToString(v,this.DateStrings==2?"yyyy-MM-dd HH:mm:ss":(this.DateStrings==1?null:this.DateStrings)):"")+"\"";
-         }
-      A[p++] = F.Spc+"GanttWidthCookie"+F.Sep+"\""+c.GanttWidth/this.Img.GanttWidth+"\"";
-      //[p++] = F.Spc+"GanttExclude"+F.Sep+"\""+(c.GanttExclude?F.Str(c.GanttExclude):"")+"\"";
-      if(F.Json) RemoveFirst(pp);
-      A[p++] = F.End;   
-      }
-   }
-
-// --- Resources ---
-
-// --- Calendars ---
-MS.GanttExclude; 
-if(type["calendars"]){
-   var X = this.Calendars;
-   if(X){
-      A[p++] = F.Json ? "\n\"Calendars\":"+(F.Json2?"[":"{") : "\n<Calendars>";
-      for(var x in X) {
-         if(F.Json2) { A[p++] = "\n{\"Name\":\""+x+"\""; }
-         else if(F.Json) A[p++] = "\n\""+x+"\":{";
-         else { A[p++] = "\n<E"; SetAttr("Name",x); }
-         SetAttr("Exclude",X[x].Exclude);
-         A[p++] = F.End;   
-         }
-      if(F.Json) RemoveLast(); 
-      A[p++] = F.Json ? "\n"+(F.Json2?"]":"}")+"," : "\n</Calendars>";
-      }
-   }
-ME.GanttExclude; 
-
-// --- Resources ---
-MS.GanttResources; 
-if(type["resources"]){
-   var X = this.Resources;
-   if(X){
-      A[p++] = F.Json ? "\n\"Resources\":"+(F.Json2?"[":"{") : "\n<Resources>";
-      for(var x in X) {
-         if(F.Json2) { A[p++] = "\n{\"Name\":"+x+"\""; }
-         else if(F.Json) A[p++] = "\n\""+x+"\":{";
-         else { A[p++] = "\n<R"; SetAttr("Name",x); }
-         SetAttr("Text",X[x].Text);
-         SetAttr("Type",X[x].Type);
-         SetAttr("Price",X[x].Price);
-         SetAttr("Availability",X[x].Availability);
-         A[p++] = F.End;   
-         }
-      if(F.Json) RemoveLast(); 
-      A[p++] = F.Json ? "\n"+(F.Json2?"]":"}")+"," : "\n</Resources>";
-      }
-   }
-ME.GanttResources; 
-
-// --- Zoom ---
-MS.GanttZoom;
-if(this.GanttZoom && type["zoom"]){
-   A[p++] = F.Json ? "\n\"Zoom\":[" : "\n<Zoom>";
-   for(var n in this.GanttZoom) SetAttrs("Z",this.GanttZoom[n],F.Json);
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json ? "]," :"\n</Zoom>";
-   }
-ME.GanttZoom;
-ME.Gantt;
-
-var cfg = "";
-var set = type["settings"]||type["config"]||type["configxlsx"] ? {  
-   LeftWidth:3,MidWidth:3,RightWidth:3,PrintRows:2,PrintPageBreaks:1,PrintExpanded:1,PrintFiltered:1,PrintSelected:1,PrintPageRoot:1,PDFText:1,
-   PrintPageWidth:2,PrintPageHeight:2,ExportType:2,Language:2,Style:2,GanttStyle:2,Size:2,Scale:2,ShowDeleted:1,PrintVisible:1,FormulaTip:1,
-   Sort:4,Group:4,SearchAction:4,SearchExpression:4,SearchType:4,SearchCaseSensitive:4,SearchCells:4,SearchMethod:4,SearchDefs:4,SearchCols:4,Rtl:1
-   } : {};
-if(type["settings"]||type["config"]){ 
-   set.ReversedTree = 1; set.ReversedColTree = 1; set.DefaultBorder = 1; set.HideZero = 1; set.FormulaShow = 1;
-   }
-if(type["settings"]) { set.Focused = 4; set.FocusedCol = 4; set.FocusedPos = 4; set.FocusedRect = 4; set.FocusedTop = 4; set.FocusedLeft = 4; }
-else if(type["focused"]){ set.Focused = 3; set.FocusedCol = 3; set.FocusedPos = 3; set.FocusedRect = 3; set.FocusedTop = 3; set.FocusedLeft = 3; }
-if(this.ShowPrintPageBreaks>=0) set.ShowPrintPageBreaks = 1;
-
-// --- AutoCols ---
-if(type["autocols"]) { cfg += GetAutoCols();  } 
-
-// --- Expanded ---
-if(type["expanded"]){
-   var chp = this.ChildPaging==3;
-   for(var s="",r=this.GetFirst();r;r=this.GetNext(r)) if(r.Expanded && (r.firstChild||chp&&r.Count)) s += r[rid]+",";
-   cfg += F.Spc+"Expanded"+F.Sep+"\""+F.Str(s.slice(0,-1))+"\"";
-   }
-
-// --- Hidden ---
-if(type["hidden"]||type["settings"]){
-   var s = "", v = "";
-   if(rowvis) for(var id in rowvis) if(rowvis[id]) v += id + ","; else s += id + ",";
-   function setvis(r){
-      var rid = ridx&&r.HasIndex?ridx:"id";
-      if((!rowvis||rowvis[r.id]==null) && Get(r,"CanHide") && (!O||!O[r[rid]]||!O[r[rid]].Visible!=!r.Visible)){
-         if(!r.Visible) s += r[rid]+","; else if(O) v += r[rid]+",";
-         }
-      }
-   if(type["hidden"]) for(var r=this.GetFirst();r;r=this.GetNext(r)) setvis(r);
-   for(var R=this.GetFixedRows(),i=0;i<R.length;i++) setvis(R[i]);
-   for(var r=this.XS.firstChild;r;r=r.nextSibling) setvis(r);
-   if(s) cfg += F.Spc+"HiddenRows"+F.Sep+"\""+F.Str(s.slice(0,-1))+"\"";
-   if(v) cfg += F.Spc+"VisibleRows"+F.Sep+"\""+F.Str(v.slice(0,-1))+"\"";
-   }
-
-// --- Cookie ---
-if(type["cookie"] && !type["cfg"]) cfg += GetAttr("Cookie",this.SaveCfg(1));
-
-// --- Cfg ---
-if(type["cfg"]){
-   this.SetFocused(type["index"]); 
-   
-      var Reg = new RegExp("^("+CDebugAttrs.Cfg.join("|")+")$");
-      for(var n in this) if(!set[n]&&n.search(Reg)==0) cfg += GetAttr(n,this[n]); 
-      
-   var SS = ["Styles","GanttStyles"];
-   for(var i=0;i<SS.length;i++){
-      var v = this[SS[i]], S = []; 
-      for(var n in v) {
-         var vv = v[n], s = [];
-         for(var nn in vv) s[s.length] = nn+":"+(vv[nn]-0||vv[nn]=="0"?vv[nn]:"'"+vv[nn]+"'");
-         S[S.length] = n+":{"+s.join(",")+"}";
-         }
-      cfg += GetAttr(SS[i],"{"+S.join(",")+"}");
-      }
-
-   if(this.Sort && !type["settings"]) {
-      cfg += GetAttr("SortCols"+this.Sort.replace(/-/g,""));
-      cfg += GetAttr("SortTypes"+this.Sort.replace(/[^-,]/g,"").replace(/-/g,"1").replace(/,,/g,",0,").replace(/^,/,"0,").replace(/,$/,",0"));
-      }
-   }  
-
-// --- Configuration from cookies ---
-if(type["settings"]||type["config"]||type["configxlsx"]||type["focused"]) {
-   if(type["settings"]||type["focused"]) this.SetFocused(type["index"]); 
-   for(var n in set) if(set[n]!=4&&(set[n]!=3||this[n]!=null)) cfg += F.Spc+n+F.Sep+"\""+(set[n]==1?(this[n]?1:0):this[n])+"\"";
-   MS.Gantt;
-   if(this.PrintVisible && this.Gantt && (type["settings"]||type["config"]||type["configxlsx"])){
-      var col = this.GetFirstGantt(), c = this.Cols[col];
-      var cleft = this.GetColLeft(col), left = this.GetScrollLeft(c.MainSec) - cleft;
-      var right = left + this.GetBodyWidth(c.MainSec); if(right>c.Width+cleft) right = c.Width+cleft;
-      if(left<0) left = 0;
-      cfg += F.Spc+"PrintVisibleLeft"+F.Sep+"\""+left+"\"";
-      cfg += F.Spc+"PrintVisibleRight"+F.Sep+"\""+right+"\"";
-      }
-   ME.Gantt;
-   if(type["settings"]) { 
-      cfg += F.Spc+"AllCols"+F.One; 
-      A[p++] = "\n"+this.GetCfgRequest(F,cfg); 
-      cfg = null; 
-      }
-   }
-
-if(cfg) {
-   if(cfg.charAt(0)==',') cfg = cfg.slice(1); 
-   A[p++] = (F.Json?"\n\"Cfg\":{":"\n<Cfg")+cfg+F.End;
-   }
-   
-// --- Def ---
-if(type["def"]){
-   A[p++] = F.Json ? "\n\"Def\":"+(F.Json2?"[":"{") : "\n<Def>";
-   for(var D in this.Def) {
-      var zu = this.Def[D].Updated; delete this.Def[D].Updated;
-      SetAttrs("D",this.Def[D],F.Json2);
-      this.Def[D].Updated = zu;
-      }
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json2 ? "]," : (F.Json ? "}," :"\n</Def>");
-   SetAttrs("Root",this.Root);
-   }
-
-// --- DefCols ---
-if(type["def"] && type["cols"]){
-   A[p++] = F.Json ? "\n\"DefCols\":"+(F.Json2?"[":"{") : "\n<DefCols>";
-   for(var D in this.DefCols) {
-      
-      SetAttrs("D",this.DefCols[D],F.Json2);
-      
-      }
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json2 ? "]," : (F.Json ? "}," :"\n</DefCols>");
-   }
-
-// --- Cols ---
-if(type["cols"]||type["settings"]||type["selected"]&&this.SelectingCols){
-   var len = this.ColNames.length;
-   var Cols1 = ["LeftCols"]; Cols1[len-1] = "RightCols";
-   var Cols2 = ["LeftCols"]; Cols2[len-1] = "RightCols";
-   var Reg = null;
-   if(type["cols"]){
-      var s = CDebugAttrs.C.join("|") + CCellAttrs.CCell.join("|") + CCellAttrs.CICell.join("|") + "|On\\w+";
-      s += ("|"+CDebugAttrs.Panel.join("|")).replace(/\|\*\|/g,"|").replace(/\*/g,"\\w*") + "|Enum\\w*";
-      if(this.Gantt) {
-         s += "|Gantt"+CDebugAttrs.CGantt.join("|Gantt") + "|Gantt"+CCellAttrs.CCellGantt.join("|Gantt") + "|Gantt"+CCellAttrs.CCellGanttX.join("\\d*|Gantt")+"\\d*";
-         s += "|GanttFormat\\d*|GanttHeader\\w*\\d*";
-         }
-      Reg = new RegExp("^("+s+")$");
-      }
-   for(var i=0;i<len;i++){
-      var N = this.ColNames[i];
-      if(i==1) A[p++] = F.Json ? "\n\"Cols\":"+(F.Json2?"[":"{") : "\n<Cols>";
-      if(N.length){
-         if(Cols1[i]) A[p++] = F.Json ? "\n\""+Cols1[i]+"\":"+(F.Json2?"[":"{") : "\n<"+Cols1[i]+">";
-         for(var ci=0;ci<N.length;ci++) {
-            var c = N[ci];
-            if(C[c].NoUpload==2||cidx&&C[c].Deleted) continue;
-            if(type["cols"]){ SetAttrs("C",C[c],F.Json2,Reg); continue; }
-            if(!type["settings"] && !C[c].Selected) continue;
-            var n = cidx && C[c].HasIndex ? cidx[c] : c;
-            if(F.Json2) { A[p++] = "\n{\"Name\":\""+n+"\""; }
-            else if(F.Json) A[p++] = "\n\""+n+"\":{";
-            else { A[p++] = "\n<C"; SetAttr("Name",n); }
-            pp = p;
-            if(type["settings"]){
-               var dw = this.Img.Width; if(!dw) dw = 1;
-               SetAttr("Width",Math.round((C[c].OldWidth?C[c].OldWidth:C[c].Width)/dw));
-               SetAttr("Visible",colvis&&colvis[c]!=null ? colvis[c] : C[c].Visible);
-               if(C[c].Spanned) SetAttr("Spanned",C[c].Spanned);
-               if(this.ColTree) SetAttr("Level",C[c].Level?C[c].Level:0);
-               
-               if(this.AutoCols && C[c].HasIndex) SetAttr("Def",C[c].Def);
-               }
-            if(C[c].Selected&&type["selected"]) SetAttr("Selected",1);
-            A[p++] = F.End;
-            if(F.Json && !F.Json2) RemoveFirst(pp);
-            }
-         if(F.Json&&(i==len-2||Cols1[i])) RemoveLast(); 
-         if(Cols2[i]) A[p++] = F.Json ? "\n"+(F.Json2?"]":"}")+"," : "\n</"+Cols2[i]+">";
-         }
-      if(i==len-2) A[p++] = F.Json ? "\n"+(F.Json2?"]":"}")+"," : "\n</Cols>";
-      }
-   }     
-
-if(O) A[p++] = F.Json?"\n\"Changes\":[":"\n<Changes>";
-
-// --- fixed rows ---
-if(type["data"] || type["all"] || type["fixed"] || O){
-   if((this.Header.id!="Header"||this.Header.Kind!="Header")&&!O) A[p++] = (F.Json?"\n\"Header\":{":"\n<Header")+F.Spc1+"id"+F.Sep+"\""+F.Str(this.Header.id)+"\""+F.Spc+"Kind"+F.Sep+"\""+F.Str(this.Header.Kind)+"\""+F.End;
-   if((this.Toolbar.id!="Header"||this.Toolbar.Kind!="Toolbar")&&!O) A[p++] = (F.Json?"\n\"Toolbar\":{":"\n<Toolbar")+F.Spc1+"id"+F.Sep+"\""+F.Str(this.Toolbar.id)+"\""+F.Spc+"Kind"+F.Sep+"\""+F.Str(this.Toolbar.Kind)+"\""+F.End;
-   var Rows = ["Head","Foot","Solid"], RF = [this.XH,this.XF,this.XS];
-   for(var j=0;j<3;j++){
-      var R = this.GetRows(RF[j]);
-      if(R.length){
-         var Reg = null; 
-         
-            s = CDebugAttrs.I.join("|") + "|\\w+On\\w+";
-            if(j==2) {
-               s += "|"+CDebugAttrs.Space.join("|") + "|"+CDebugAttrs.Group.join("|") + "|"+CDebugAttrs.Search.join("|") + "|"+CDebugAttrs.Toolbar.join("|");
-               s += "|\\w*"+CCellAttrs.SpaceCell.join("|\\w*");
-               }
-            else {
-               if(this.Gantt) s += "|\\w*Gantt"+CCellAttrs.CCellGantt.join("|\\w*Gantt") + "|\\w*"+CCellAttrs.CCellGanttX.join("\\d*|\\w*Gantt")+"\\d*";
-               s += "|"+CDebugAttrs.Header.join("|") + "|\\w*"+CCellAttrs.FilterCell.join("|\\w*");
-               s += ("|"+CDebugAttrs.Panel.join("|")).replace(/\|\*\|/g,"|").replace(/\*/g,"\\w*").replace(/\|/g,"|\\w*") + "|\\w*Enum\\w*";;
-               var a = [], CC = this.Cols; for(var n in CC) if(CC[n].Type!="Gantt") a[a.length] = n;
-               s += "|"+a.join("|");
-               }
-            s += "|\\w*"+CCellAttrs.Cell.join("|\\w*") + "|\\w*"+CCellAttrs.CCell.join("|\\w*") + "|\\w*"+CCellAttrs.CICell.join("|\\w*");
-            
-            Reg = new RegExp("^("+s+")$");
-            
-         if(!O) A[p++] = F.Json ? "\n\""+Rows[j]+"\":[" :"\n<"+Rows[j]+">";
-         for(var i=0;i<R.length;i++) if(R[i].Kind=="Data" || type["all"] || type["fixed"]) {
-            var Z = {};
-            if(R[i].Kind.slice(0,7)=="Toolbar"){ 
-               Z["Empty"] = R[i]["Empty"]; delete R[i]["Empty"]; 
-               for(var k=0,RIC=R[i].Cells;k<RIC.length;k++) if(R[i][RIC[k]+"Formula"]) { Z[RIC[k]] = R[i][RIC[k]]; delete R[i][RIC[k]]; }
-               }
-            if(R[i].Cells) { 
-               if(s) Reg = new RegExp("^("+s+"|"+R[i].Cells.join("|")+")$"); 
-               Z.Cells = R[i].Cells; 
-               if(R[i].Cells[0]=="Panel") {
-                  Z.Panel = R[i].Panel; R[i].Panel = R[i]["PanelVisible"];
-                  R[i].Cells.shift();
-                  }
-               R[i].Cells = R[i].Cells.join(","); 
-               }
-            var cp = p;
-            if(!SetRowAttrs("I",R[i],Reg)&&noempty) { p = cp; A.length = p; }
-            else {
-               if(this.Gantt&&R[i].Kind=="Header"&&!R[i][this.Gantt+"GanttHeader"]) A[p++] = GetAttr(this.Gantt,R[i][this.Gantt]); 
-               A[p++] = F.End;
-               }
-            for(var n in Z) { R[i][n] = Z[n]; }
-            }
-         if(!O) {
-            if(F.Json) RemoveLast(); 
-            A[p++] = F.Json ? "\n]," : "\n</"+Rows[j]+">";
-            }
-         }
-      }
-   }
-
-// --- variable rows ---
-if(type["body"] || type["data"] || type["all"] || O){
-   var name = "Body";
-   if(!O) A[p++] = F.Json ? "\n\""+name+"\":[" : "\n<"+name+">";
-   var BA = { LevelImg:1,Level:1,Hasch:1,Page:1,State:1,LastAccess:1,Visible:1 };
-   var Reg = null; 
-   
-      s = CDebugAttrs.I.join("|") + "|\\w+On\\w+";
-      if(this.Paging==3&&!O) s += "|\\w+"+CDebugAttrs.BCellICell.join("|\\w+");
-      s += ("|"+CDebugAttrs.Panel.join("|")).replace(/\|\*\|/g,"|").replace(/\*/g,"\\w+").replace(/\|/g,"|\\w+") + "|\\w+Enum\\w+";
-      s += "|\\w+"+CCellAttrs.Cell.join("|\\w+") + "|\\w+"+CCellAttrs.CCell.join("|\\w+") + "|\\w*"+CCellAttrs.CICell.join("|\\w*");
-      if(this.Gantt) s += "|\\w+Gantt"+CCellAttrs.CCellGantt.join("|\\w+Gantt") + "|\\w+"+CCellAttrs.CCellGanttX.join("\\d*|\\w+Gantt")+"\\d*";
-      var a = [], CC = this.Cols; for(var n in CC) if(CC[n].Type!="Gantt") a[a.length] = n;
-      s += "|"+a.join("|");
-      Reg = new RegExp("^("+s+")$");
-      
-   if(this.Paging==3&&!O) {
-      for(var B=this.XB.firstChild;B;B=B.nextSibling){
-         var S = "";
-         if(B.id) S += GetAttr("id",B.id);
-         for(var n in B) if(!RA[n] && !BA[n]) S += GetAttr(n,B[n]); 
-         if(F.Json){
-            if(S) {
-               if(S.charAt(0)==',') S = S.slice(1);
-               A[p++] = "\n{"+S+",\"Items\":[";
-               }
-            else A[p++] = "[";
-            }
-         else A[p++] = "\n<B" + S + ">";
-         for(var r=B.firstChild;r;r=r.nextSibling) SetRowChildren("I",r,Reg);
-         if(F.Json) RemoveLast();
-         A[p++] = F.Json ? (S?"]},":"],") : "\n</B>";
-         }
-      if(F.Json) RemoveLast(); 
-      }
-   else {
-      if(!O) A[p++] = F.Json ? "[" : "\n<B>";
-      var lr = null; if(this.AutoPages) lr = this.GetLastDataRow((alldef?16:0)+(U&&U.Name=="ExportPDF"?32:0));
-      for(var B=this.XB.firstChild;B;B=B.nextSibling) for(var r=B.firstChild;r;r=r.nextSibling) { SetRowChildren("I",r,Reg); if(r==lr) { B = this.XB.lastChild; break; } }
-      if(O&&!ridx){ 
-         var N = this.Rows; 
-         for(var id in O) { 
-            var n = ridx?this.GetRowByIndex(id):N[id]; if(n&&!n.Deleted) continue;
-            A[p++] = F.Json ? "\n{" : "\n<I"; 
-            var pp = p;
-            if(ridx&&O[id].HasIndex) SetAttr("id",O[id][ridx]); 
-            else if(O[id].id) SetAttr("id",O[id].id); 
-            SetAttr("Deleted",1); 
-            if(F.Json) RemoveFirst(pp);
-            A[p++] = F.End; 
-            }
-         }
-      if(F.Json&&!O) RemoveLast();
-      if(!O) A[p++] = F.Json ? "]" : "\n</B>";
-      }
-   if(!O) A[p++] = F.Json ? "\n]," : "\n</"+name+">";
-   }
-
-// --- Selected ---
-var sel = (type["selected"]||type["resized"]) && !type["changes"] && (!O||attrs||allcols);
-if(!O&&(sel||type["changes"])) A[p++] = F.Json?"\n\"Changes\":[":"\n<Changes>";
-if(sel){
-   var res = type["resized"], sel = type["selected"];
-   
-   var R = this.GetFixedRows(), allcols = type["allcols"];
-   function AddSel(row){
-      if(ridx&&row.Deleted) return;
-      A[p++] = "\n"+F.Start+F.Str(row[rid])+"\"";
-      if(sel && row.Selected) A[p++] = F.Spc+"Selected"+F.Sep+"\""+row.Selected+"\"";
-      if(res && row.Resized) A[p++] = F.Spc+"Height"+F.Sep+"\""+row.Height+"\"";
-      if(F.Dtd) A[p++] = F.End;
-      if(allcols) SetRowCols(row); if(!O) SetCustomAttrs(row); 
-      if(sel && row.Selected&2) { for(var c in C) if(row[c+"Selected"]) SetAttr(c+"Selected",row[c+"Selected"]); }
-      A[p++] = F.Dtd ? "</I>" : F.End;
-      }
-   for(var i=0;i<R.length;i++) if(sel&&R[i].Selected||res&&R[i].Resized) AddSel(R[i]);
-   for(var r=this.XS.firstChild;r;r=r.nextSibling) if(sel&&r.Selected||res&&r.Resized) AddSel(r);
-   for(var r=this.GetFirst();r;r=this.GetNext(r)) if(sel&&r.Selected||res&&r.Resized) AddSel(r);
-   if(F.Json) RemoveLast();
-   }
-
-// --- Changes ---
-if(type["changes"]) A[p++] = this.GetChanges(null,1+(type["selected"]?2:0)+(type["resized"]?4:0),alldef+allcols+(type["newid"]?4:0)+(type["fullmoved"]?8:0)+(noformula?16:0)+(type["noupload"]?32:0),attrs,F);
-
-if(O||sel||type["changes"]) {
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json?"],":"\n</Changes>";
-   }
-
-// --- Spanned ---
-if(type["span"]){
-   A[p++] = F.Json?"\n\"Spanned\":[":"\n<Spanned>";
-   for(var r=this.GetFirst();r;r=this.GetNext(r)){
-      var s = "", o = O ? O[r[rid]] : null;
-      if(r.Spanned||r.RowSpan||o&&(o.Spanned||o.RowSpan)) for(var col in C) {
-         if((o?r[col+"Span"]!=o[col+"Span"]&&(r[col+"Span"]>1||o[col+"Span"]>1)||r[col+"RowSpan"]!=o[col+"RowSpan"]&&(r[col+"RowSpan"]>1||o[col+"RowSpan"]>1):r[col+"Span"]>1||r[col+"RowSpan"]>1) && r[col+"RowSpan"]!=0 && r[col+"Visible"]!=-2) {
-            s += F.Spc+col+"Span"+F.Sep+"\""+F.Str(r[col+"Span"]==null?1:r[col+"Span"])+"\""+F.Spc+col+"RowSpan"+F.Sep+"\""+F.Str(r[col+"RowSpan"]==null?1:r[col+"RowSpan"])+"\"";
-            }
-         }
-      
-      if(s) A[p++] = F.Start + F.Str(r[rid]) + "\"" + s + F.End;
-      }
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json?"],":"\n</Spanned>";
-   }
-
-// --- Lang ---
-if(type["lang"]){
-   A[p++] = F.Json ? "\n\"Lang\":{" : "\n<Lang>";
-   for(var i in this.Lang){ 
-      var v = this.Lang[i];
-      A[p++] = F.Json ? "\n\""+i+"\":{" : "\n<"+i; pp = p;
-      var reg = i=="Format" ? new RegExp("^("+CDebugAttrs.Format.join("|")+")$") : null;
-      for(var n in v){
-         if(v[n]==null||reg&&n.search(reg)!=0);
-         else if(v[n].join) SetAttr(n,v[n].join(",")); 
-         else SetAttr(n,v[n]); 
-         }
-      if(F.Json) RemoveFirst(pp);
-      A[p++] = F.End;
-      
-      }
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json ? "\n}," : "\n</Lang>";
-   }
-
-// --- Text ---
-MS.Lang;
-if(type["text"]) for(var xx in this.Text) {
-   A[p++] = F.Json ? "\n\"Text"+xx+"\":{" : "\n<Text"+xx+">";
-   var R = this.Text[xx];
-   for(var r in R) {
-      var Set = {}, CC = R[r], hasset = 0;
-      for(var c in CC){
-         var D = CC[c], P = {};
-         for(var d in D){
-            if(d=="set") { Set[c] = D[d]; hasset = 1; continue; }
-            if(d=="change") { P["Change"] = D[d]; continue; }
-            var N = D[d], Reg = null, Rep = null;
-            for(var n in N) {
-               if(n.charAt(n.length-1)=="@");
-               else if(N[n+"@"]) { if(!Reg) Reg = {}; Reg[n] = N[n]; }
-               else { if(!Rep) Rep = {}; Rep[n] = N[n]; }
-               }
-            if(Rep) P["Replace"] = Rep;
-            if(Reg) P["Regex"] = Reg;
-            }
-         for(var d in P){
-            var N = P[d], X = {}, T = {}, hasu = 0;
-            if(r=="@All");
-            else if(r=="@Space") T.Space = 1;
-            else if(r.charAt(0)=="@") T.Kind = r.slice(1);
-            else if(r.charAt(0)=="#") T.Def = r.slice(1);
-            else T.Row = r;
-            if(c=="@All");
-            else if(c.charAt(0)=="@") T.Type = r.slice(1);
-            else T.Col = c;
-            for(var n in N) if(!F.Json&&n.search(/\W/)>=0) { X[n] = N[n]; hasu++; } else T[n] = N[n]; 
-            if(hasu){
-               var S = "\n<"+d;
-               for(var n in T) S += GetAttr(n,T[n]); 
-               if(hasu==1) for(var n in X) S += " N=\""+F.Str(n)+"\" V=\""+F.Str(X[n])+"\"/>";
-               else {
-                  S += ">";
-                  for(var n in X) S += "<U N=\""+F.Str(n)+"\" V=\""+F.Str(X[n])+"\"/>";
-                  S += "</"+d+">";
-                  }
-               A[p++] = S;
-               }
-            else SetAttrs(d,T);
-            }
-         }
-      if(hasset) {
-         if(r=="@All");
-         else if(r=="@Space") Set.Space = 1;
-         else if(r.charAt(0)=="@") Set.Kind = r.slice(1);
-         else if(r.charAt(0)=="#") Set.Def = r.slice(1);
-         else Set.Row = r;
-         SetAttrs("Set",Set);
-         }
-      }
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json ? "\n}," : "\n</Text"+xx+">";
-   }
-
-// --- Languages ---
-if(type["other"]||type["languages"]){
-   A[p++] = F.Json ? "\n\"Languages\":{" : "\n<Languages>";
-   for(var n in this.Languages) SetAttrs("L",this.Languages[n]); 
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json ? "\n}," : "\n</Languages>";
-   }
-ME.Lang;
-
-// --- Other ---
-if(type["other"]||type["menu"]) {
-   SetAttrs("MenuCfg",this.MenuCfg);
-   SetAttrs("MenuColumns",this.MenuColumns);
-   SetAttrs("MenuPrint",this.MenuPrint);
-   SetAttrs("MenuExport",this.MenuExport);
-   }
-if(type["other"]) SetAttrs("GanttExport",this.GanttExport);
-if(type["other"]||type["animations"]) SetAttrs("Animations",this.Animations);
-
-// --- Actions ---
-if(type["other"]||type["actions"]) {
-   var S = "";
-   for(var n in this.Actions) S += GetAttr(n,this.Actions[n]); 
-   for(var n in this.Mouse) S += GetAttr(n,this.Mouse[n]); 
-   S += F.Spc+"KeyCodes9"+F.Sep+"\"";
-      for(var n in this.KeyCodes) {
-      S += this.KeyCodes[n]+"="+n+","; 
-      }
-   S = S.slice(0,-1) + "\"";
-   if(F.Json && S && S.charAt(0)==',') S = S.slice(1); 
-   A[p++] = "\n"+(F.Json ? "\"Actions\":{" : "<Actions")+S+F.End;
-   }
-
-// --- Pagers ---
-if(this.Pagers.length && (type["other"]||type["pagers"])){
-   A[p++] = F.Json ? "\n\"Pagers\":"+(F.Json2?"[":"{") : "\n<Pagers>";
-   
-   var Reg = new RegExp("^("+CDebugAttrs.Pager.join("|")+"|"+CDebugAttrs.PagerXXX.join("|")+")$");
-   for(var i=0;i<this.Pagers.length;i++) SetAttrs("P",this.Pagers[i],F.Json2,Reg);
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json2 ? "]," : (F.Json ? "}," :"\n</Pagers>");
-   }
-
-// --- Media ---
-MS.Media;
-if(type["other"]||type["media"]){
-   A[p++] = F.Json ? "\n\"Media\":[" : "\n<Media>";
-   for(var i=1;i<this.Media.length;i++){ 
-      var v = this.Media[i];
-      A[p++] = F.Json ? "\n{" : "\n<M";
-      var a = v.Attrs; 
-      if(a) { 
-         var pp = p;
-         for(var n in a) {
-            if(n=="Style"){
-               var vv = a[n], s = []; for(var nn in vv) s[s.length] = nn;
-               SetAttr(n,s.join(","))
-               }
-            else if(n=="Size" && typeof(a[n])=="object"){
-               SetAttr(n,a[n].source.replace(/\|/g,","));
-               }
-            else SetAttr(n,a[n]); 
-            }
-         if(F.Json) { RemoveFirst(pp); A[p++] = ","; }
-         }
-      A[p++] = F.Json ? "" : ">";
-      for(var n in v) {
-         if(n=="Lang"){
-            A[p++] = F.Json ? "\n\"Lang\":{" : "\n<Lang>";
-            var vv = v[n]; for(var nn in vv) SetAttrs(nn,vv[nn]);
-            if(F.Json) RemoveLast();
-            A[p++] = F.Json ? "\n}," : "\n</Lang>";
-            }
-         else if(n=="Cols"||n=="Rows"||n=="Def"||n=="Pagers"){
-            var vv = v[n]; 
-            A[p++] = F.Json ? "\n\""+n+"\":[" :"\n<"+n+">";
-            var tn = {Rows:"I",Cols:"C",Def:"D",Pagers:"Pager"}[n];
-            
-            for(var nn in vv) {
-               A[p++] = F.Json ? "\n{" : "\n<"+tn;   
-               var pp = p, vvv = vv[nn]; 
-               if(n=="Rows"&&this.Rows[vvv.id].Space){ 
-                  var Cells = ","+this.Rows[vvv.id].Cells.join(",")+",";
-                  for(var nnn in vvv) SetAttr(nnn.search(/Left$/)>=0&&Cells.search(","+nnn+",")>=0&&Cells.search(","+nnn.slice(0,-4)+",")>=0?nnn+"Width":nnn,vvv[nnn]);
-                  }
-               else for(var nnn in vvv) SetAttr(nnn,vvv[nnn]);
-               if(F.Json) RemoveFirst(pp);
-               A[p++] = F.End;
-               }
-            if(F.Json) RemoveLast();
-            A[p++] = F.Json ? "\n]," : "\n</"+n+">";
-            }
-         else if(n!="Attrs"&&n!="Media") SetAttrs(n,v[n]);
-         }
-      if(F.Json) RemoveLast();
-      A[p++] = F.Json ? "}," :"\n</M>";
-      }
-   if(F.Json) RemoveLast();
-   A[p++] = F.Json ? "\n]," : "\n</Media>";
-   }
-ME.Media;
-
-if(F.Json) RemoveLast();
-if(!type["nogrid"]) A[p++] = F.Json ?"\n}" :"\n</Grid>";
-if(grp) { var zalgrp = this.Group; this.Group = ""; this.DoGrouping(zalgrp,-1); }
-if(this.Img.Width!=1){
-   if(type["cols"]) this.MultiplyScale(this.Img.Width,9);
-   if(type["other"]) this.MultiplyScale(this.Img.Width,10);
-   if(type["all"]||type["fixed"]) this.MultiplyScale(this.Img.SpaceWidth,12);
-   if(this.Gantt&&type["cols"]) this.MultiplyScale(this.Img.GanttWidth,24);
-   }
-this.Focused = null; 
-//lertTimer();
-
-return A.join("");
-ME.UploadType;
-NoModule("UploadType");
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetChangesOrder = function(){
-var C = this.Changes, A = [], p = 0, F = this.GetUploadFormat(this.Source.Upload), ind = this.SaveOrder==2;
-var names;
-MS.Debug; names = "changes,selected,expanded,body,data,all,settings,cookie,cfg,def,cols,other,lang,defaults,allcols,nodelete,noio,nogrid,gantt,span,spanned,calendars,resources,newid"; ME.Debug;
-var flags = this.ConvertFlags(this.Source.Upload.Flags,names), NewId = flags["newid"];
-for(var i=0;i<C.length;i++){
-   if(!C[i]) continue;
-   var O = C[i], s = F.Start+F.Str(O.Row)+"\"", newid = null;
-   if(O.Deleted) { A[p++] = s+F.Spc+"Deleted"+F.One+F.End; continue; }
-   var Q = {}, U = {}, CH = null; 
-   for(;i<C.length;i++){
-      var P = C[i];
-      if(P.Row!=O.Row){ i--; break; }
-      if(P.Deleted){ Q = null; if(!O.Added) i--; break; } 
-      if(P.Added||P.Moved) {
-         if(P.Added) U.Added = 1;
-         else if(P.Moved && !U.Added) U.Moved = P.Moved;
-         if(P.Parent!=null) U.Parent = F.Str(P.Parent);
-         if(P.Next!=null) U.Next = F.Str(P.Next);
-         else if(U.Next) delete U.Next; 
-         if(P.Copy) U.Copy = F.Str(P.Copy);
-         }
-      
-      else U.Changed = 1;
-      if(P.Col) Q[P.Col] = P.Val;
-      if(P.Cols) for(var c in P.Cols) Q[c] = P.Cols[c];
-      
-      MS.GenId;
-      if(NewId && this.IdMore && (U.Changed||U.Moved) && newid==null) {
-         var row = this.Rows[P.Row];
-         if(row){
-            CH = this.UpdateNewId(row,"NewId",0,U.Changed,U.Moved,Q);
-            newid = row.NewId ? row.NewId : "";
-            }
-         }
-      ME.GenId;
-      if(ind) break;
-      }   
-   MS.GenId; if(newid) s += F.Spc+"NewId"+F.Sep+"\""+newid+"\""; ME.GenId;
-   for(var c in U) s += F.Spc+c+F.Sep+"\""+U[c]+"\"";
-   if(!Q) continue; 
-   if(F.Dtd) s += ">";
-   for(var c in Q){    
-      var v = Q[c]; if(v==null) continue;
-      v = this.ConvertUpload(this.GetRowById(O.Row),c,v,this.FormulaEditing);
-      if(F.Dtd) s += "<U N=\""+c+"\" V=\""+F.Str(v)+"\"/>";
-      else s += F.Spc+c+F.Sep+"\""+F.Str(v)+"\"";
-      }
-   s += F.Dtd ? "</I>" : F.End;
-   MS.GenId; if(CH) for(var id in CH) s += F.Start+F.Str(id)+"\""+F.Spc+"NewId"+F.Sep+"\""+CH[id]+"\""+F.End; ME.GenId; 
-   A[p++] = s;
-   }
-if(F.Json && p && A[p-1] && A[p-1].slice(-1)==',') A[p-1] = A[p-1].slice(0,-1); 
-return A.join("");   
-}
-// -----------------------------------------------------------------------------------------------------------
-ME.Upload;
-// -----------------------------------------------------------------------------------------------------------
-TGP.SetChange = function(O,fill){
-MS.Upload;
-if(!O.Row) return; 
-var C = this.Changes;
-if(fill) {
-   O.Cols = { }; var row = this.GetRowById(O.Row);
-   for(var c in this.Cols) if(c!="Panel" && c!="id") O.Cols[c] = Get(row,c);
-   }
-if(O.Deleted==0){ 
-   for(var i=0;i<C.length;i++){
-      if(C[i] && C[i].Deleted&&C[i].Row==O.Row) { C[i] = null; return; };
-      }  
-   
-   }   
-C[C.length] = O;
-ME.Upload;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.SaveOrigData = function(){
-MS.Upload;
-var t = (this.Source.Upload.Type+this.Source.Export.Type+this.Source.ExportPDF.Type+"").toLowerCase();
-if(t.indexOf("cells")<0) return;
-var ridx = t.indexOf("index")>=0 ? this.RowIndex : null, idx = ridx ? ridx : "id", O = {}, R = this.Rows, mc = this.MainCol;
-for(var id in R) {
-   var r = R[id], o = {}; if(!r[idx]) continue;
-   for(var n in r) o[n] = r[n];
-   if(!ridx){
-      o.parentNode = r.parentNode.Page ? null : r.parentNode.id;
-      if(r.nextSibling) o.nextSibling = r.nextSibling.id;
-      else if(r.parentNode.Page && r.parentNode.nextSibling && r.parentNode.nextSibling.firstChild) o.nextSibling = r.parentNode.nextSibling.firstChild.id;
-      if(r.previousSibling) o.previousSibling = r.previousSibling.id;
-      else if(r.parentNode.Page && r.parentNode.previousSibling && r.parentNode.previousSibling.lastChild) o.previousSibling = r.parentNode.previousSibling.lastChild.id;
-      }
-   else if(mc) o.Level = r.Level;
-   O[r[idx]] = o;
-   }
-this.OrigData = O;
-ME.Upload;
-}
-// -----------------------------------------------------------------------------------------------------------
diff --git a/Grid/Filter.js.bak b/Grid/Filter.js.bak
deleted file mode 100644
index 00f2beb..0000000
--- a/Grid/Filter.js.bak
+++ /dev/null
@@ -1,859 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// Rows filtering
-// -----------------------------------------------------------------------------------------------------------
-MS.Filter;
-// -----------------------------------------------------------------------------------------------------------
-// Returns cell value as string for filter
-TGP.GetStringFilter = function(row,col,raw){
-var v = Get(row,col+"FilterValue");
-if(v==null) v = raw ? Get(row,col)+"" : this.GetString(row,col,3)+"";
-else v += "";
-if(Grids.OnGetFilterValue) { var tmp = Grids.OnGetFilterValue(this,row,col,v,raw?0:1); if(tmp!=null) v = tmp; }
-return v;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns cell value as number for filter
-TGP.GetNumberFilter = function(row,col,equalf){
-var v = Get(row,col+"FilterValue");
-if(v==null) v = equalf ? this.GetString(row,col) : Get(row,col);
-if(v=="0") v = 0;
-if(Grids.OnGetFilterValue) { var tmp = Grids.OnGetFilterValue(this,row,col,v,equalf?1:0); if(tmp!=null) v = tmp; }
-MS.Range;
-if(v && typeof(v)=="string" && this.IsRange(row,col)){ 
-   v = v.split(this.Lang.Format.ValueSeparator)[0];
-   var vp = v.indexOf(this.Lang.Format.RangeSeparator);
-   if(vp>=0) v = v.slice(0,vp)-0;
-   else v-=0;
-   }
-ME.Range;   
-return v;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Creates filter acording to row of type "Filter" and sets it to Filter1
-TGP.BuildFilter = function(){
-var F = "", C = this.Cols, R = this.GetFixedRows();
-var Op = ["","==","!=","<","<=",">",">="];
-var OpS = ["","==0","!=0","<0","<=0",">0",">=0"], tmp = 1, code = "";
-var wo = this.FilterReplaceOne ? new RegExp(ToRegExp(this.FilterReplaceOne)) : null, wm = this.FilterReplaceMore ? new RegExp(ToRegExp(this.FilterReplaceMore)) : null;
-for(var i=0;i<R.length;i++){
-   var r = R[i];
-   if(r.Kind!="Filter") continue;
-   for(var c in C){
-      var ff = r[c+"Filter"]-0; if(!ff) continue;
-      var cf = C[c].CanFilter;
-      if(!cf) continue;
-      if(F) F += " &&";
-      if(cf==2) F += "(TGGet(Row,'"+c+"CanFilter')==0?2:";
-      var def = r[c+"FilterDef"]; if(def==null) def = r.Def[c+"FilterDef"]; if(def==null) C[c].FilterDef;
-      if(def) F += "(" + (def.indexOf(",")<0 ? "Row.Def.Name!='"+def+"'" : "!{"+def.replace(/,/g,":1,")+":1}[Row.Def.Name]") + "?2:";
-      var type = this.GetType(r,c), range = this.IsRange(r,c);
-      MS._Debug;if(0){ ME._Debug; MS.Range;MX.Range;range=null;ME.Range; MS._Debug; } ME._Debug;
-      if(ff<=6 && (CAlignRight[type] || type=="Bool" || (type=="Enum" || type=="Radio")&&Get(r,c)-0+""==Get(r,c))){
-         var equalf = Get(r,c+"EqualFormatted")?1:0, par = "";
-         if(equalf){
-            if(ff==4||ff==6) { F += " ("+this.This+".GetNumberFilter(Row,'"+c+"',1)=='"+this.GetString(r,c)+"' ||"; par = 1; }
-            else if(ff==3||ff==5) { F += " ("+this.This+".GetNumberFilter(Row,'"+c+"',1)!='"+this.GetString(r,c)+"' &&"; par = 1; }
-            if(ff>2) equalf = 0;
-            }
-         var cn = this.This+".GetNumberFilter(Row,'"+c+"',"+equalf+")";
-         var val = equalf ? this.GetString(r,c) : this.GetValue(r,c);
-         if(type=="Enum" || type=="Radio"){
-            var fof = Get(r,c+"FilterOff");
-            if(val>fof) val--;
-            }
-         if(range && val && ff<=2 && typeof(Get(r,c))=="string"){
-            MS.Range;
-            var frm = equalf ? this.GetFormat(r,c) : "";
-            val = Get(r,c)+""; if(!val) val = "";
-            if(ff==2) F += "!";
-            F += "(";
-            var A = val.split(this.Lang.Format.ValueSeparator);
-            for(var j=0;j<A.length;j++){
-               var B = A[j].split(this.Lang.Format.RangeSeparator);
-               if(j) F+=" || ";
-               if(B[1]) F += "tmp"+tmp+">="+B[0]+" && tmp"+tmp+"<="+B[1];
-               else if(B[0]===""||B[0]===String.fromCharCode(160)) F += "tmp"+tmp+"=="+((ff==1 || ff==2) && this.GetAttr(r,c,"CanEmpty") && (type!="Bool"||Get(r,c+"ShowMenu")!='0')?"=":"")+"''";
-               else if(frm) F += "tmp"+tmp+"=='"+this.Lang.Format.NumberToString(B[0],frm)+"'";
-               else F += "tmp"+tmp+"=="+B[0];
-               }
-            F += ")";
-            if(val&&this.FilterIgnoreEmpty&8) F += " && tmp"+tmp+"!==''";
-            code += "var tmp"+(tmp++)+"="+cn+";";
-            ME.Range;
-            }   
-         else {  
-            if(!val){
-               if(val==="") val="''";
-               if((ff==1 || ff==2) && this.GetAttr(r,c,"CanEmpty") && (type!="Bool"||Get(r,c+"ShowMenu")!='0')) val = "="+val; 
-               }
-            else if(this.FilterIgnoreEmpty&(ff>2?1:8)) { code += "var tmp"+(tmp++)+"="+cn+";"; cn = "tmp"+(tmp-1); F += cn+"!==''&&"; }
-            F += " "+cn+Op[ff]+(equalf ?"'"+val+"'" : val);
-            }
-         if(par) F += ")";
-         }
-      else {         
-         var val = this.GetString(r,c,3);
-         var cn = this.This+".GetStringFilter(Row,'"+c+"')";
-         if(type=="Enum" && Is(r,c+"FilterEnumKeys")) { val = Get(r,c); cn = this.This+".GetStringFilter(Row,'"+c+"',1)"; }
-         
-         MS.CharCodes;
-         var codes = this.GetAttr(r,c,"CharCodes");
-         if(codes) { 
-            cn = "TGUseCharCodes("+cn+",'"+codes+"')";
-            val = UseCharCodes(val,codes);
-            }
-         ME.CharCodes;
-         var local = this.GetAttr(r,c,"LocaleCompare");
-         var cas = this.GetAttr(r,c,"CaseSensitive");
-         var ft = Get(r,c+"FilterType"); if(ft==null) ft = Get(r,"FilterType"); if(ft!=null){ local = ft&2?1:0; cas = ft&4?0:1; } 
-         if(!cas){
-            val = local ? val.toLocaleLowerCase() : val.toLowerCase();
-            cn = cn+".to"+(local?"Locale":"")+"LowerCase()";
-            }
-         var white = GetWhiteChars(this.GetAttr(r,c,"WhiteChars"));
-         if(white){
-            val = val.replace(white,"");
-            cn = cn+".replace("+white+",'')";
-            }
-         var orig = val;
-         val = (val+"").replace(/\\/g,"\\\\").replace(/\'/g,"\\\'");
-         if(this.CanAcceptEnters && this.CanAcceptEnters(r,c) && ff<=10) val = val.replace(/\n/g,"\\n");
-         function replacewildcards(val){
-            if(wo) val = val.replace(wo,"\u65011");
-            if(wm) val = val.replace(wm,"\u65012");
-            val = val.replace(/[\^\$\.\*\+\?\=\!\:\|\/\(\)\[\]\{\}\/]/g,"\\$&").replace(/\n/g,"\\n").replace(/\u65011/g,".").replace(/\u65012/g,".*");
-            if(ff<=8) val = "^"+val; else if(ff<10) val += "$";
-            return val;
-            }
-         if(range && (ff<=2 || ff>=7)){
-            MS.Range;
-            var sep = this.Lang.Format.ValueSeparator;
-            if(ff==2 || ff==8 || ff==10 || ff==12) F += "!";
-            F += "(";
-            var A = val.split(sep), oa = orig.split(sep);
-            for(var j=0;j<A.length;j++){
-               if(j) F+=" || ";
-               if(A[j]==="" || A[j]===String.fromCharCode(160)) F += "tmp" + tmp + "==''"; 
-               else if(ff<=6) {
-                  if(range==2) F += " tmp"+tmp+".search(/(^|"+ToRegExp(sep)+")"+ToRegExp(A[j])+"($|"+ToRegExp(sep)+")/)>=0";
-                  else F += " tmp"+tmp+"=='"+A[j]+"'";
-                  }
-               else if(wo||wm){ A[j] = replacewildcards(A[j]); F += " tmp"+tmp+".search(/"+A[j]+"/)>=0"; }
-               else if(ff<=8)   F += " tmp"+tmp+".slice(0,"+oa[j].length+")=='"+A[j]+"'";
-               else if(ff<=10) F += " tmp"+tmp+".slice(-"+oa[j].length+")=='"+A[j]+"'";
-               else if(ff<=12) F += " tmp"+tmp+".search(/"+A[j].replace(/[\^\$\.\*\+\?\=\!\:\|\/\(\)\[\]\{\}\/]/g,"\\$&").replace(/\n/g,"\\n")+"/)>=0";
-                 
-               }
-            F += ")";
-            if(val && this.FilterIgnoreEmpty&(ff>6?4:16)) F += " && tmp"+tmp+"!==''";
-            code += "var tmp"+(tmp++)+"="+cn+"+'';";
-            ME.Range;
-            }
-         else if(val==="" || val===String.fromCharCode(160)) F += cn + (ff&1?"==":"!=") + "''"; 
-         else {
-            if(this.FilterIgnoreEmpty&&val&&this.FilterIgnoreEmpty&(ff>6?4:(ff>2?2:16))) { code += "var tmp"+(tmp++)+"="+cn+";"; cn = "tmp"+(tmp-1); F += cn+"!==''&&"; }
-            if(ff<=6) F += " "+cn+(local?".localeCompare('"+val+"')"+OpS[ff] : Op[ff]+"'"+val+"'");
-            else if(wo||wm) { val = replacewildcards(val); F += " "+cn+".search(/"+val+"/)"+(ff&1?">=0":"<0"); }
-            else if(ff<=8) F += " "+cn+".slice(0,"+orig.length+")"+(ff==7?"==":"!=")+"'"+val+"'";
-            else if(ff<=10) F += " "+cn+".slice(-"+orig.length+")"+(ff==9?"==":"!=")+"'"+val+"'";
-            else if(ff<=12) F += " "+cn+".search(/"+val.replace(/[\^\$\.\*\+\?\=\!\:\|\/\(\)\[\]\{\}\/]/g,"\\$&").replace(/\n/g,"\\n")+"/)"+(ff==11?">=0":"<0");
-            }
-         }
-      if(def) F += ")";
-      if(cf==2) F += ")";
-      }
-   }
-this.Filter1 = F ? new Function("Row",code+"return "+F) : null;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Aplies filter to grid
-// Can be called with given cell, in this case updates the operator
-TGP.DoFilter = function(row,col,nosync){
-if(!this.Filtering) return;
-if(row && !row[col+"Filter"]){ 
-   var def = Get(row,col+"DefaultFilter"); if(def==0) return; 
-   row[col+"Filter"] = def>0 ? def : ({"Text":1,"Lines":1,"Link":1,"Img":1,"Html":1,"EHtml":1,"Auto":1}[this.GetType(row,col)] ? 11 : 1);
-   
-   if(this.Undo&16) this.AddUndo({ Type:"Filter",Row:row,Col:col,OldOp:0,NewOp:row[col+"Filter"],OpChange:1});
-   }
-this.SaveCfg();
-this.ColorFilterCells();
-MS.Sync;
-if(this.Sync["filter"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["filter"]) {
-         var F1 = this.GetFilterRows(), F2 = G.GetFilterRows(), chg = 0;
-         for(var j=0;j<F1.length && F2[j];j++){
-            for(var c in this.Cols) if(G.Cols[c] && (F1[j][c] != F2[j][c] || F1[j][c+"Filter"] != F2[j][c+"Filter"])){
-               F2[j][c] = F1[j][c]; F2[j][c+"Filter"] = F1[j][c+"Filter"]; 
-               G.RefreshCell(F2[j],c);
-               chg = 1;
-               }
-            }
-         if(chg) { G.SaveCfg(); G.ColorFilterCells(); G.DoFilter(); }
-         }
-      }
-   }
-ME.Sync;
-//if(!this.Filtered) return;//去掉限制
-/***去掉客户端过滤代码
-MS.Paging;
-if(this.Paging==3 && (!(this.OnePage&2) || this.AllPages)){  
-   if(Grids.OnCanFilter && !Grids.OnCanFilter(this,0) || Grids.OnFilter && Grids.OnFilter(this,0)) return;
-    if(!this.AllPages) this.FPage = 0;
-     this.ReloadBody(null,0,"Filter"); 
-     return; 
-   }
-ME.Paging;
-*/
-this.BuildFilter();
-if((this.formid != 9646&&this.formid != 9654)&&(BIE8Strict&&this.RowSpan || (this.Paging || this.LoadedCount>this.SynchroCount) && (!(this.OnePage&2) || this.AllPages))){//****直接把数据库提交后台,重新查询结果显示 by2014-11-20
-	   
-	   //*****增加树+格线,没选择树节点时候增加提示
-       if (typeof (isclick) != "undefined") {
-        if (isclick != undefined && isclick == false) {
-        	alert(this.GetText("treeNodeFilter"));
-        	return;
-        }
-    }
-	   
-	    var where=null;
-	    var whereF=null;
-	    
-	     		where=this.Data.Page.Url.match(/where=&/);
-	       whereF=this.Data.Data.Url.match(/where=&/);
-	   
-	    if(where==null){
-	      where=this.Data.Page.Url.match(/where=*.+?&/);
-	     whereF=this.Data.Data.Url.match(/where=*.+?&/);
-	    }
-        if(where){
-        	var tok="";
-        	if(this.gType==7){
-        		tok=this.GetText("FText");
-        	}else{
-        		tok=this.GetText("FilterText");
-        	}
-       	var temp="";
-       	if(this.gType==7){
-       		temp= where[0].replace("&","").split(",")[0].split(this.GetText("FText"))[0]+tok+this.getFilterInfo()+"&";
-       		
-       	}else{
-          temp=where[0].replace("&","").split(",")[0].split(this.GetText("FilterText"))[0]+tok+this.getFilterInfo()+"&";
-      }
-        	this.Data.Page.Url=this.Data.Page.Url.replace(where,temp);
-        	this.Data.Data.Url=this.Data.Data.Url.replace(whereF,temp);
-        }
-       this.ReloadBody(null,1,"Filter"); 
-	
-}else if(this.formid == 9646||this.formid == 9654){//***9646调用 this.prg=true表示调用页面过滤,不需要传到后台执行
-   this.ShowMessage(this.GetText("DoFilter")); 
-   var T = this; setTimeout(function(){ T.DoFilterT(BIE8Strict&&T.RowSpan||T.Paging?2:1); T.HideMessage(); },10); 
-   }
-else this.DoFilterT(1); 
-}
-// -----------------------------------------------------------------------------------------------------------
-// Colors all filter according to their activity
-TGP.ColorFilterCells = function(noshow){
-var F = this.GetFixedRows();
-for(var i=0;i<F.length;i++){
-   var row = F[i];
-   if(row.Kind!="Filter") continue;
-   var chg = false;
-   for(var c in this.Cols) { 
-      var chgc = row[c+"Filter"] ? 1 : 0
-      row[c+"Changed"] = chgc;
-      if(chgc) chg = true;
-      }
-   row.Changed = chg;
-   if(noshow) continue;
-   MS.Animate;
-   if(row.AnimatingCells&&!row.Animating){ 
-      for(var c=this.GetFirstCol();c;c=this.GetNextCol(c)) if(!row.AnimatingCells[c]) this.RefreshCell(row,c); 
-      continue;
-      }
-   ME.Animate;
-   this.RefreshRow(row); 
-   }
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.FilterChildren = function(row,show,S,H,CF){
-var T = this, std = this.StandardFilter, sd = this.ShowDeleted, orf = Grids.OnRowFilter;
-var F1 = this.Filtered ? this.Filter1 : null, F2 = this.Searched ? this.Filter2 : null, F3 = this.Filter3;
-var isf = F1 || F2 || F3, Calc = this.GetCalc(), cf2 = this.ColorFilter==2, fh = std ? this.FilterHideParents : 0, fe = this.FilterEmpty;
-var std3 = 0; if(std==3){ std = 0; std3 = 1; }
-
-// --- Filters row and all its children ---
-
-function FilterRow(r,nf){
-   if(r.Deleted && !sd) return 0; 
-   var hasf = 0, f, ff;
-   if(std) {
-      if(!r.firstChild) hasf =  r.State<2 && r.Count;
-      else for(var n=r.firstChild;n;n=n.nextSibling) hasf += FilterRow(n);   
-      if(r.Calculated) T.CalcRow(r,Calc,"CalcOrder",show==1,0,1);              
-      }
-   var cf = r.CanFilter; if(cf==null) cf = r.Def.CanFilter;
-   if(nf) {
-      f = !r.Visible&&!r.Filtered; 
-      if(cf2){
-         if(isf) { var f1 = F1 ? F1(r) : 2, f2 = F2 ? F2(r) : 2, f3 = F3 ? F3(r,T) : 2; ff = f1&&f2&&f3 ? (f1!=2||f2!=2||f3!=2 ? 1 : 2) : 0; } else ff = 2;
-         if(orf) { var tmp = orf(T,r,ff); if(tmp!=null) ff = tmp; }
-         if(ff&&ff!=2) { f = 0; nf = 0; }
-         }
-      }
-   else if(cf&1 && r.Kind=="Data") { 
-      if(isf) { var f1 = F1 ? F1(r) : 2, f2 = F2 ? F2(r) : 2, f3 = F3 ? F3(r,T) : 2; f = f1&&f2&&f3 ? (f1!=2||f2!=2||f3!=2 ? 1 : 2) : 0; } else f = 2;
-      if(orf) { var tmp = orf(T,r,f); if(tmp!=null) f = tmp; }
-      if(f==2) { f = cf&2 ? null : !r.Visible&&!r.Filtered; cf = cf&2; }
-      else f = f ? 0 : 1;
-      if(f && std==2 && hasf) f = null;                                
-      }
-   else f = cf&2 ? null : !r.Visible&&!r.Filtered; 
-   if(!std && !f || std3) {
-      if(!r.firstChild) hasf =  r.State<2 && r.Count;
-      else for(var n=r.firstChild,cnf=std3&&!f&&(cf&1);n;n=n.nextSibling) hasf += FilterRow(n,cnf); 
-      if(std3 && hasf && f && fh!=1) f = null;
-      }
-   if(isf && fe && (cf&2&&(f!==0||fe!=3)&&(fe==1||r.firstChild)||r.CPage) && !hasf) f = 1;                              
-   if(show==-1) return f ? 0 : hasf+1;
-   if(r.Hidden==null?!r.Def.Hidden:!r.Hidden){ 
-      r.Visible = !f;
-      if(show==1){
-         if(f){ if(!r.Filtered&&(r.r1||fh)||fh==2&&r.Expanded&2||fh==1&&hasf&&(!(r.Expanded&2))) H[H.length] = r; }    
-         else if(r.Filtered) { S[S.length] = r; r.HasF = hasf; } 
-         else if(CF&&r.Filtered!==(cf&&!nf?f:null)) CF[CF.length] = r; 
-         }
-      }
-   r.Filtered = cf&&!nf ? f : null; 
-   
-   return !f ? hasf+1 : fh==1 ? hasf : 0;
-   }
-
-var cnt = 0;
-if(Try){ for(var r=row.firstChild;r;r=r.nextSibling) cnt += FilterRow(r); }
-else if(Catch){ MS.Debug; T.Debug(1,"Error in Filter: ",e.message?e.message:e); ME.Debug; }
-return cnt;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.HasFilter = function(){
-return (this.Filtered&&this.Filter1?1:0) + (this.Searched&&this.Filter2?2:0) + (this.Filter3?4:0) + (Grids.OnRowFilter?8:0);
-}
-// -----------------------------------------------------------------------------------------------------------
-// Aplies filter to grid, called asynchronously
-// Filters according to functions Filter1,Filter2,Filter3
-// for noshow = true does not display changes - called at start
-TGP.DoFilterT = function(show){
-this.FilterCount = null;
-if(!this.Filtering || Grids.OnCanFilter && !Grids.OnCanFilter(this,this.Loading) || Grids.OnFilter && Grids.OnFilter(this,show?0:(this.Loading?1:2))) return;
-var hasf = this.Filtered&&this.Filter1 || this.Searched&&this.Filter2 || this.Filter3 || Grids.OnRowFilter, fh = this.StandardFilter ? this.FilterHideParents : 0; if(fh&&show==1) show = 2;
-if(!hasf && !this.FilterActive) return;
-if(this.ShowFocused && this.Focused==null) this.SetFocused();
-var zfa = this.FilterActive;
-this.FilterActive = hasf;
-MS.Debug; this.Debug(4,"Filtering rows"); this.StartTimer("Filter"); ME.Debug;
-var FP = null;
-MS.Paging; 
-if(this.Paging && this.OnePage&2 && !this.AllPages) FP = this.GetFPage(); 
-else if(this.XB.childNodes.length>1) this.RemovePages();
-ME.Paging; 
-if(show==1 && this.HiddenBody) { this.HiddenBody = null; for(var i=this.FirstSec;i<this.SecCount;i++) if(this.BodyMain[i]) this.BodyMain[i].parentNode.parentNode.style.display = ""; } 
-MS.Gantt;
-var ZB = null; 
-if(this.Gantt){ 
-   var col = this.GetFirstGantt(), C = this.Cols[col];
-   if(C && C.GanttFitVisible&1 && !C.GanttSize) {
-      ZB = [C.GanttFirst,C.GanttLast];
-      C.GanttZoomMin = null; C.GanttZoomMax = null; 
-      }
-   }  
-ME.Gantt;
-var H = [], S = [], CF = this.ColorFilter ? [] : null;
-
-MS.Calc;
-if(zfa&&this.Calculating&&this.Calculated&&!this.NoCalc){ 
-   var R = [];
-   function Reset(b,R){
-      for(var r=b.firstChild;r;r=r.nextSibling){
-         if(r.Filtered && !r.Visible){ R[R.length] = r; r.Filtered = 0; r.Visible = 1; }
-         if(r.firstChild) Reset(r,R);
-         }
-      }
-   for(var b=this.XB.firstChild;b;b=b.nextSibling) Reset(b,R);
-   this.Calculate(0,0,0,0,1);
-   for(var i=0;i<R.length;i++){ R[i].Visible = 0; R[i].Filtered = 1; }
-   }
-ME.Calc;
-
-this.FilterCount = this.FilterChildren((FP?FP:this.XB.firstChild),fh?1:show,S,H,CF); 
-if(show==1 && H.length+S.length>this.SynchroCount) show = 2;
-
-if(fh&&show!=1){
-   for(var i=0;i<H.length;i++){
-      var r = H[i];
-      if(r.firstChild){
-         if(fh==1){ if(!(r.Expanded&2)) r.Expanded |= 2; }
-         else if(r.Expanded&2) r.Expanded &= ~2;
-         if(r.Hasch) this.UpdateChildrenLevelImg(r,show?1:0,1);
-         }
-      }
-   for(var i=S.length-1;i>=0;i--){ 
-      var r = S[i];
-      if(r.firstChild && r.Expanded&2) {
-         r.Expanded &= ~2;
-         if(r.Hasch) this.UpdateChildrenLevel(r);
-         }
-      }
-   }
-
-if(!show) {
-   MS.Debug; this.StopTimer("Filter"); ME.Debug;
-   if(Grids.OnFilterFinish) Grids.OnFilterFinish(this,this.Loading?1:2);
-   return;
-   }
-
-if(show==1){
-   this.Rendering = 1;
-   var clrsel = this.ClearSelected&2, dyb = this.DynamicBorder;
-
-   for(var i=0;i<H.length;i++){
-      var r = H[i];
-      MS.Animate; if(r.Animating||r.AnimatingCells) this.AnimRow(r); ME.Animate;
-      if(fh&&!r.Hasch&&r.firstChild&&this.HasChildren(r)) this.Expand(r,null,1); 
-      if(r.Hasch) {
-         if(fh) {
-            if(fh==1) r.Expanded |= 2; else r.Expanded &= ~2;
-            this.UpdateChildrenLevel(r);
-            if(!this.HideTree) this.SetWidth(this.MainCol,0,1,r);
-            }
-         if(!(r.Expanded&2)) this.TableCollapse(r);
-         else if(fh&&!r.Visible) this.TableExpand(r);
-         }
-      
-      this.TableHideRow(r);
-      if(clrsel){
-         this.ClearChildSelection(r); 
-         if(r.Selected&this.SelAnd && this.CanSelect(r)) this.SelectRow(r,0,0,1);
-         }
-      
-      }
-
-   for(var i=S.length-1;i>=0;i--){ 
-      var r = S[i];
-      MS.Animate; if(r.Animating||r.AnimatingCells) this.AnimRow(r); ME.Animate;
-      
-      this.TableShowRow(r,1);
-      if(r.Hasch && fh && r.Expanded&2) {
-         r.Expanded &= ~2;
-         this.UpdateChildrenLevel(r);
-         if(!this.HideTree) this.SetWidth(this.MainCol,0,1,r);
-         }
-      if(r.Expanded && r.HasF) this.Expand(r,true,0,1);
-      if(r.parentNode.Expanded && r.parentNode.Visible) this.TableExpand(r.parentNode); 
-      
-      if(r.Hasch && r.Expanded) {
-         if(r.HasF) this.TableExpand(r);
-         else this.TableCollapse(r);
-         }
-      r.HasF = null;
-      }
-
-   if(CF) for(var i=0;i<CF.length;i++) this.ColorRow(CF[i]);
-
-   this.Rendering = 0;
-   }
-
-MS.CPages; if(this.ChildPaging) this.CreateAllCPages(this.XB,1); ME.CPages;
-if(this.HideFRow) this.HideFRow(); 
-if(this.MainCol) this.UpdateAllLevelImg(show==1,1);
-
-if(this.Paging && !FP) this.CreatePages();
-this.CalcTreeWidth();
-if(show==1){
-   this.Calculate(1,1);
-   this.UpdateEmptyRows();
-   this.ReColor(); 
-   if(this.FRow && !this.FRow.Fixed) this.ScrollIntoView(this.FRow);
-   this.Update();
-   this.UpdateCursors(1); 
-   if(this.ShowFocused) this.FocusFocused();
-   }
-else {
-   this.Calculate(2,1);
-   this.RenderBody();
-   }
-MS.Chart; if(this.Charts) this.UpdateCharts(); ME.Chart;
-MS.Gantt; 
-if(ZB && (ZB[0]!=C.GanttFirst||ZB[1]!=C.GanttLast)){ 
-   this.RefreshGantt(223,col); 
-   }  
-else if(this.GanttDependency) this.RefreshGantt(17,col); 
-
-MS.Animate; if(show==1) this.AnimRows([S,"ShowFilter",1],[H,"HideFilter",1]); ME.Animate;
-ME.Gantt;
-MS.Debug; this.Debug(4,"TreeGrid filtered in ",this.StopTimer("Filter")," ms"); ME.Debug;
-if(Grids.OnFilterFinish) Grids.OnFilterFinish(this,0);
-}
-// -----------------------------------------------------------------------------------------------------------
-// Displays menu for filter select
-TGP.ShowFilterMenu = function(row,col,inrow,test,arow){
-if(this.Disabled || !row || this.Locked["filter"] || (inrow ? row.Kind!="Filter" : Get(row,col+"Icon")!="Filter" && Get(row,col+"Button")!="Filter")) return false;
-if(test) return true;
-
-var D = this.Dialog;
-if(D && D.Row==row && D.Col==col){  
-   this.CloseDialog();
-   return true; 
-   }
-var defs = null, M = FromJSON(Get(row,col+"FilterMenu"));
-if(!M) M = { };
-else if(typeof(M)=="string") M = { Items:SplitToArray(M) };
-if(M.length&&M[0]!=null) M = {Items:M};
-if(M.Items){
-   function Init(Items){
-      for(var i=0;i<Items.length;i++){
-         var I = Items[i];
-         if(I.Name>=0 && I.Name<=12){
-            if(!I.Text) I.Text = T.Lang["MenuFilter"]["F"+I.Name];
-            I.LeftHtml = "<div class='"+T.Img.Style+"Filter"+I.Name+"Menu'>"+CNBSP+"</div>";
-            }
-         else if(I.Items) Init(I.Items);
-         }
-      }
-   var T = this; 
-   TMenu.InitMenu(M);
-   Init(M.Items);
-   }
-else { 
-   M.Items = [];
-   var it = Get(row,col+"MenuItems");
-   if(it){
-      it = (it+"").split(",");
-      for(var n=0;n<it.length;n++){
-         var i = it[n];
-         if(i>=0 && i<=12){
-            M.Items[M.Items.length] = {
-               Name:i, Text:this.Lang["MenuFilter"]["F"+i], 
-               LeftHtml:"<div class='"+this.Img.Style+"Filter"+i+"Menu'>"+CNBSP+"</div>" 
-               };
-            }
-         }
-      }
-   else {
-      var typ = this.GetType(row,col), a;
-      if(typ=="Bool") a = 3;
-      else if(CAlignRight[typ]) a = 7;
-      else a = 13;
-      for(var i=0;i<a;i++){
-         M.Items[M.Items.length] = {
-            Name:i,Text:this.Lang["MenuFilter"]["F"+i], 
-            LeftHtml:"<div class='"+this.Img.Style+"FilterAllMenu "+this.Img.Style+"Filter"+i+"Menu'>"+CNBSP+"</div>"
-            };
-         }
-      }
-   defs = Get(row,col+"FilterDefs");
-   if(defs){
-      defs = defs.split(",");
-      var cap = this.Lang["MenuFilter"]["Defs"+(defs.length==1?"1":"")], def = this.GetAttr(row,col,"FilterDef"), d = {};
-      if(def){ def = def.split(","); for(var i=0;i<def.length;i++) d[def[i]] = 1; }
-      if(defs.length==1) defs = def;
-      M.Items[M.Items.length] = { Name:cap?cap:"-",Caption:1 };
-      for(var i=0;i<defs.length;i++) if(this.Def[defs[i]]){
-         M.Items[M.Items.length] = {
-            Name:defs[i], Bool:1, Left:1, Value:!def?1:d[defs[i]]?1:0, Text:this.Def[defs[i]].FilterMenuName, Disabled:def==defs
-            };
-         }
-      if(defs!=def) { M.Buttons = defs.length > 5 ? ["Ok","Clear","Cancel"] : ["Ok","Cancel"]; M.Texts = this.Lang.MenuButtons; }
-      }
-   }
-   
-
-if(!M.MinWidth) M.MinWidth = 0; 
-if(M.Class==null) M.Class = this.Img.Style+"FilterMenu";
-if(M.CloseClickHeader==null) M.CloseClickHeader = 1;
-if(M.ShowCursor==null) M.ShowCursor = 0;
-M.Cursor = Get(row,col+"Filter");
-if(!M.Cursor) M.Cursor = 0;
-if(M.Header==null && !this.GetRotate(row,col) && (!this.Scale||this.Scale==1) && !this.ScaleX) M.Header = "<div class='"+this.Img.Style+"FilterAllMenu "+this.Img.Style+"Filter"+M.Cursor+"Menu'>"+CNBSP+"</div>";
-
-var P = this.CellToWindow(arow?arow:row,col,row[col+"Button"]=="Filter"?0:4);
-P.X = P.AbsX; P.Y = P.AbsY;
-P.AlignHeader = CAlignTypes[row[col+"IconAlign"]]=="Right"||row[col+"Button"]=="Filter"?"right middle":"left middle";
-      
-var T = this;
-M.OnCSave = function(I,V){
-   if(V&&defs){
-      for(var i=0,v={};i<V.length;i++) v[V[i]] = 1;
-      for(var i=0;i<defs.length;i++) if(!v[defs[i]]) break;
-      if(i==defs.length) V = [];
-      }
-   T.SetFilterOp(row,col,I?I.Name-0:row[col+"Filter"],V.join(","));
-   }
-   
-this.SetDialogBase(M,row,col,"Filter");
-this.TranslateMenu(row,col,M,null,"FilterMenu");
-this.Dialog = ShowMenu(M,P);
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionShowFilterMenu = function(F,T){ var A = this.GetACell(F); return A ? this.ShowFilterMenu(A[0],A[1],0,T) : false; }
-TGP.ActionShowFilterMenuRow = function(F,T){ var A = this.GetACell(F); return A ?  this.ShowFilterMenu(A[0],A[1],1,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionFilterBy = function(F,T){ var A = this.GetACell(F); return A ?  this.FilterBy(A[0],A[1],0,null,T) : false; }
-TGP.ActionFilterByMenu = function(F,T){ var A = this.GetACell(F); return A ?  this.FilterBy(A[0],A[1],1,null,T) : false; }
-TGP.ActionFilterByMenuRow = function(F,T){ var A = this.GetACell(F); return A ?  this.FilterBy(A[0],A[1],2,null,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.FilterBy = function(row,col,menu,F,test){
-if(!row||!col) return false;
-if(!F) F = this.GetFilterRows()[0]; if(!F) return false;
-var def = Get(F,col+"DefaultFilter"); if(def==0&&!menu) return; 
-var val = Get(row,col), old = Get(F,col); 
-if(val==old && (val&&val+""==old+"" || val===old) && !menu && F[col+"Filter"]==(def>0 ? def : ({"Text":1,"Lines":1,"Link":1,"Img":1}[this.GetType(F,col)] ? 11 : 1))) return false;
-if(menu && !this.ShowFilterMenu(F,col,menu==2?1:0,1) || menu==1 && !F.Visible) return false;
-if(test) return true;
-val = this.GetValueInput(row,col,val);
-this.FinishEdit(F,col,val,menu?-1:-2);
-if(menu) this.ShowFilterMenu(F,col,menu==2?1:0,0,F.Visible?null:row);
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionClearFilter = function(F,T){ 
-var A = this.GetACell(F); if(!A) return false; 
-var row = A[0], col = A[1]; if(row.Space) return false;
-var A = this.GetFilterRows()[0]; if(!A||!A[col+"Filter"]) return false;
-if(T) return true;
-this.SetFilterOp(A,col); 
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionClearFilters = function(dummy,T){ 
-var F = this.GetFilterRows()[0]; if(!F) return false;
-var ok = 0; for(var c in this.Cols) if(F[c+"Filter"]) { ok = 1; break; }
-if(!ok) return false;
-if(T) return true;
-this.ChangeFilter();
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.UpdateRelatedFilter = function(row,col){
-
-var rel = this.GetAttr(row,col,"Related");
-if(rel && row[col+"Filter"]){
-   rel = rel.split(",");
-   for(var i=0;i<rel.length;i++){ 
-      if(!row[rel[i]+"Filter"]){ row[rel[i]+"Filter"] = 1; this.RefreshCell(row,rel[i]); }
-      }
-   }
-
-var ref = this.GetAttr(row,col,"Refresh"), clr = this.GetAttr(row,col,"Clear");
-if(ref || clr){
-   ref = (ref+","+clr).split(",");
-   for(var i=0;i<ref.length;i++){ 
-      if(ref[i] && row[ref[i]+"Filter"]){ row[ref[i]+"Filter"] = 0; row[ref[i]] = ""; this.RefreshCell(row,ref[i]); } 
-      }
-   }
-}
-
-// -----------------------------------------------------------------------------------------------------------
-// Sets number of filter operator
-TGP.SetFilterOp = function(row,col,op,def){
-if(!row) return;
-if(!op && this.ClearFilterOff && Get(row,col)) row[col] = "";
-this.CloseDialog();
-var odef = this.GetAttr(row,col,"FilterDef"), oop = row[col+"Filter"];
-if((oop==op || !oop&&!op) && (def==odef || !def&&!odef) || this.Paging==3 && !(this.OnePage&2) && !this.CanReload()) return;
-if(Grids.OnFilterOperator && Grids.OnFilterOperator(this,row,col,op,oop,def,odef)) return;
-if(this.Undo&16) this.AddUndo({ Type:"Filter",Row:row,Col:col,OldOp:oop,NewOp:op,OldDef:odef,NewDef:def,OpChange:1});
-row[col+"Filter"] = op;
-if(def||odef) row[col+"FilterDef"] = def;
-
-this.UpdateRelatedFilter(row,col);
-
-if(this.EditMode){ 
-   var frow = this.ERow, fcol = this.ECol;
-   this.ClearFilterSpec = 1; 
-   if(this.EndEdit(1) && row==frow && col==fcol) { this.ClearFilterSpec = null; return; } 
-   this.ClearFilterSpec = null;
-   }
-   
-this.RefreshCell(row,col);
-this.DoFilter();
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ChangeFilter = function(cols,vals,opers,nofilter,noclear,F){
-cols = SplitToArray(cols);
-vals = SplitToArray(vals);
-opers = SplitToArray(opers);
-if(!F) F = this.GetFilterRows()[0];
-if(!F) return;
-var O = {};
-F.Changed=cols.length?1:0;
-for(var i=0;i<cols.length;i++){
-   var col = cols[i];
-   O[col] = 1;
-   if(this.GetType(F,col)=="Date" && vals[i]-0+""!=vals[i]) { F[col] = this.ConvertDate(vals[i],null,null,0); if(F[col]-0+""==F[col]) F[col] -= 0; }
-   else F[col] = vals[i]-0+""==vals[i] ? vals[i]-0 : vals[i];
-   F[col+"Filter"] = opers[i]?opers[i]-0:0;
-   F[col+"Changed"] = 1;
-   }
-if(!noclear) for(var col in this.Cols){
-   if(!O[col]){
-      F[col]=null;
-      F[col+"Filter"] = 0;
-      F[col+"Changed"] = 0;
-      }
-   }
-this.RefreshRow(F);
-if(!nofilter) this.DoFilter();
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionFilterOff = function(dummy,T){ return this.SetFiltered(0,T); }
-TGP.ActionFilterOn = function(dummy,T){ return this.SetFiltered(1,T); }
-// -----------------------------------------------------------------------------------------------------------
-TGP.SetFiltered = function(val,test,nosync,noundo){
-if(!this.Filtering || this.Filtered==val || this.Locked["filter"]) return false;
-if(test) return true;
-MS.Sync;
-if(this.Sync["filter"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["filter"]) G.SetFiltered(val,0,1);
-      }
-   }
-ME.Sync;
-if(this.Undo&16&&!noundo) this.AddUndo({Type:"Filtered",OFiltered:this.Filtered,Filtered:val});
-this.Filtered = val;
-
-MS.Animate; if(this.AnimateCells&&!this.SuppressAnimations&&this.ARow&&this.ARow.Kind=="Filter"&&this.ACol&&this.GetType(this.ARow,this.ACol)=="Panel") this.RefreshCellAnimate(this.ARow,this.ACol,"Edit"); ME.Animate;
-this.ColorFilterCells(); 
-
-this.SaveCfg();
-MS.Paging;
-if(this.Paging==3 && (!(this.OnePage&2) || this.AllPages)){  
-   if(Grids.OnCanFilter && !Grids.OnCanFilter(this,0) || Grids.OnFilter && Grids.OnFilter(this,0)) return true;
-    if(!this.AllPages) this.FPage = 0;
-     this.ReloadBody(null,0,"Filter"); 
-     return true; 
-   }
-ME.Paging;
-if(val) this.BuildFilter(); 
-if(!this.Filter1) return true;
-if(!val) { var F1 = this.Filter1; this.Filter1 = null; this.Filtered = 1; }
-if(BIE8Strict&&this.RowSpan || (this.Paging || this.LoadedCount>this.SynchroCount) && (!(this.OnePage&2) || this.AllPages)){ 
-   this.ShowMessage(this.GetText("DoFilter")); 
-   var T = this; setTimeout(function(){ 
-      if(T.Paging&&!val) { T.Filtered = 0; T.FinishAnimations(); T.Filtered = 1; } 
-      T.DoFilterT(BIE8Strict&&T.RowSpan||T.Paging ? 2 : 1); 
-      T.HideMessage(); 
-      if(!val){ T.Filtered = 0; T.Filter1 = F1; } 
-      },10); 
-   }
-else { this.DoFilterT(1); this.HideMessage(); if(!val){ this.Filtered = 0; this.Filter1 = F1; }  } 
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-// ----------------------------------------------------------------------------------------------------------
-MS.Range;
-TGP.FilterTextRange = function(col,val,name,show,ssep){
-var sep = this.Lang.Format.ValueSeparator;
-if(!name) name = "F3";
-if(val) {
-   val = (val+"").split(sep);
-   for(var i=0;i<val.length;i++) val[i] = val[i].replace(/[\^\$\.\*\+\?\=\!\:\|\\\/\(\)\[\]\{\}\/]/g,"\\$&");
-   ssep = ssep ? ToRegExp(ssep) : "";
-   val = "(^|[\\"+sep+ssep+"])("+val.join('|')+")($|[\\"+sep+ssep+"])";
-   var F = "return "+this.This+".GetStringFilter(Row,'"+col+"').search(/"+val+"/)>=0";
-   }
-else F = "";
-
-this.SetFilter(name,F,col,show,1);
-}
-ME.Range;
-// ----------------------------------------------------------------------------------------------------------
-MS.Range;
-TGP.FilterDateRange = function(col,val,name,show){
-if(!name) name = "F3";
-var F;
-if(val) {
-   val = this.ConvertDate(val,null,null,0).split(this.Lang.Format.ValueSeparator);
-   for(var i=0;i<val.length;i++) {
-      var v = val[i].split(this.Lang.Format.RangeSeparator);
-      val[i] = "tmp>="+v[0]+"&&tmp<="+(v[1]==null?v[0]:v[1]);
-      }
-   F = "var tmp="+this.This+".GetNumberFilter(Row,'"+col+"');return "+val.join("||");
-   }
-else F = "";
-this.SetFilter(name,F,col,show,1);
-}
-ME.Range;
-
-// -----------------------------------------------------------------------------------------------------------
-TGP.SetFilter = function(name,filter,col,show){
-if(show==null) show = 2;
-if(filter) {
-   var raw = filter;
-   if(col && this.Cols[col]) {
-      if((filter+"").replace(/\"[^\"]*\"|\'[^\']*\'/,"").indexOf("return")<0) filter = "return "+filter;
-      var row = this.GetFilterRows()[0], def = row ? this.GetAttr(row,col,"FilterDef") : this.Cols[col].FilterDef;
-      filter = "if(!TGGet(Row,'CanFilter')"+(this.Cols[col].CanFilter==2?"||TGGet(Row,'"+col+"CanFilter')==0":"")+(def ? (def.indexOf(",")<0 ? "||Row.Def.Name!='"+def+"'" : "||!{"+def.replace(/,/g,":1,")+":1}[Row.Def.Name]") : "")+")return 2;"+filter;
-      }
-   filter = this.GetFormula(filter);
-   }
-if(!this.Filter3) {
-   if(!filter) return;
-   this.Filter3Raws = [raw]; this.Filter3Cols = [col];
-   this.Filter3Filters = [filter];
-   this.Filter3Names = [name];
-   this.Filter3 = new Function("row","grid","for(var i=0,F3F=grid.Filter3Filters,Calc={Row:row,Grid:grid};i<F3F.length;i++)if(!F3F[i](Calc))return 0;return 1;");
-   }
-else {
-   var F3N = this.Filter3Names, F3F = this.Filter3Filters, F3R = this.Filter3Raws, F3C = this.Filter3Cols;
-   for(var i=0;i<F3N.length;i++) if(F3N[i]==name) break;
-   F3N.splice(i,1); F3F.splice(i,1); F3R.splice(i,1); F3C.splice(i,1);
-   if(filter){ i = F3N.length; F3F[i] = filter; F3N[i] = name; F3R[i] = raw; F3C[i] = col; }
-   if(!F3N.length) this.Filter3 = null;
-   }
-if(show) { 
-   this.DoFilterT(show==2&&this.MainTable&&!this.Loading&&!this.Rendering?(BIE8Strict&&this.RowSpan || (this.Paging || this.LoadedCount>this.SynchroCount) && (!(this.OnePage&2) || this.AllPages) ? 2 : 1):0); 
-   if(this.SaveFilters) this.SaveCfg(); 
-   }
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetFilter = function(spec){
-if(spec){
-   var A = [], F3N = this.Filter3Names;
-   if(F3N) for(var i=0;i<F3N.length;i++) A[A.length] = [F3N[i],this.Filter3Raws[i],this.Filter3Cols[i]];
-   return A;
-   }
-var C = this.Cols, R = this.GetFilterRows(), A = [];
-for(var i=0;i<R.length;i++){
-   var r = R[i];
-   for(var c in this.Cols){
-      var ff = r[c+"Filter"]-0; if(!ff || !C[c].CanFilter) continue;
-      A[A.length] = [c,Get(r,c),ff];
-      }
-   }
-return A;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.FilterHiddenCols = function(H){
-if(this.FilterHidden!="0") return;
-var F = this.GetFilterRows(), chg = 0; if(!F) return;
-for(var j=0;j<H.length;j++) for(var i=0;i<F.length;i++) if(F[i][H[j]+"Filter"]){ F[i][H[j]+"Filter"] = 0; chg = 1; }
-if(chg) {
-   this.SaveCfg();
-   MS.Paging;
-   if(this.Paging==3 && (!(this.OnePage&2) || this.AllPages)){  
-      if(Grids.OnCanFilter && !Grids.OnCanFilter(this,0) || Grids.OnFilter && Grids.OnFilter(this,0)) return;
-       if(!this.AllPages) this.FPage = 0;
-        this.ReloadBody(null,0,"Filter"); 
-        return; 
-      }
-   ME.Paging;
-   this.BuildFilter();
-   this.DoFilterT(1);
-   }
-}
-ME.Filter;
-// -----------------------------------------------------------------------------------------------------------
diff --git a/Grid/RenderRow.js b/Grid/RenderRow.js
index e950086..84bc09c 100644
--- a/Grid/RenderRow.js
+++ b/Grid/RenderRow.js
@@ -669,7 +669,7 @@
                }
             }
          }
-//**状态控制 把这个功能已经移到setPession
+//**状态锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷丫锟斤拷频锟絪etPession
 	   if(this.formid!=9802&&!this.cp&&(type=="Text"||type=="Int"||type=="Float"||type=="Date"||type=="Bool"||type=="Enum"||
 	      type=="Lines"||type=="Html"||type=="Link"||type=="Radio"||type=="List"||type=="Pass")){
 	   		   var cc=this.Cols[col];
@@ -727,7 +727,7 @@
                else if(!f&&!range&&(type=="Auto"?!L.IsExactNumber(val):!(val-0)&&val!="0")) { 
                   if(type=="Auto") { typecls = "Type"+prefix+"Text"; val = L.FormatString(val,null,1,range); }
                   else{
-                  	// val = L.NaN;//****去掉,显示原值
+                  	// val = L.NaN;//****去锟斤拷锟斤拷锟斤拷示原值
                   	 }
                   }
                else { 
@@ -785,7 +785,7 @@
                val = L.FormatString(val,f,(type=="Lines"?this.NoFormatEscape!="0":this.NoFormatEscape)?1:2,range);
                if(trans) val = this.Translate(row,col,val,type);
                }
- /* 去掉**** 
+ /* 去锟斤拷**** 
             else if(typeof(val)=="string"){ 
                if(trans) val = this.Translate(row,col,val,type);
                if(val.search(L.CSearchEscape1)>=0) val = val.replace(L.CReplaceAmp,"&amp;").replace(L.CReplaceLt,"&lt;");
@@ -1201,6 +1201,12 @@
             MS.Digits; if(L.Digits&&(po+"").search(/\d/)>=0) po = L.ConvertDigits(po,this.GetAttr(row,col,"Digits")); ME.Digits;
             if(val.charAt(val.length-1)==">" && val.slice(-6)=="</div>") val = val.replace("</div>",po+"</div>");
             else val += po;
+            //***47绫诲瀷鎺т欢闇�瑕佹竻闄ょ┖鏍煎�硷紝涓嶇劧&nbsp;浼氬崰鐢ㄧ┖闂撮�犳垚100%杩涘害涔熷崰涓嶆弧 */
+            try{
+            if(this.Cols[col].colType!=undefined&&this.Cols[col].colType==47){
+               val=val.replace(CNBSP,"");
+            }
+         }catch(e){}
             }
          if(trans && (pr!=null||po!=null)) val = this.Translate(row,col+"Fix",val,type);
 
diff --git a/Grid/SelRow.js.bak b/Grid/SelRow.js.bak
deleted file mode 100644
index 0704969..0000000
--- a/Grid/SelRow.js.bak
+++ /dev/null
@@ -1,211 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// Functions for selecting rows
-// -----------------------------------------------------------------------------------------------------------
-MS.Select;
-// -----------------------------------------------------------------------------------------------------------
-// If the row (cells=0) or its cells (cells=1) can be selected
-TGP.CanSelect = function(row,cells){
-var can = row.CanSelect; if(can==null && row.Def) can = row.Def.CanSelect;
-return cells ? can==1||can==3 : (can==1||can==2)&&(!row.Deleted||!(this.ClearSelected&1));
-}
-// -----------------------------------------------------------------------------------------------------------
-// Support function for GetSelRows, recursion
-TGP.GetSelChildren = function(row,and,clr,attr,A,first){
-for(var r=row.firstChild;r;r=r.nextSibling) {
-   if(r.Deleted&&clr&1 || r.Filtered&&clr&2) continue;
-   if(clr&4&&!r.Visible&&!r.Deleted&&!r.Filtered){
-      if(r.Expanded&2 && r.firstChild && this.GetSelChildren(r,and,clr,attr,A,first)) return true; 
-      continue;
-      }
-   if(r.Selected&and && (!attr||Is(r,attr)) && r!=A[0]) {
-      A[A.length] = r;
-      if(first==1 || r.firstChild && (r.Expanded||clr&8) && clr&16 && this.GetSelChildren(r,and,clr,attr,A,first)) return true;
-      }
-   else if(first==0&&this.CanSelect(r,0) || r.firstChild && (r.Expanded||clr&8) && this.GetSelChildren(r,and,clr,attr,A,first)) return true;
-   }
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns array of all selected rows, in order in that are in table
-TGP.GetSelRows = function(type,attr,first,A){
-var clr = this.ClearSelected^8 | (type&8?0:16), and = type&3; if(and==0) and = this.SelAnd;
-if(!A) A = [];
-if(type&4 && this.GetSelChildren(this.XH,and,clr,attr,A,first)) return true;
-for(var p=this.XB.firstChild;p;p=p.nextSibling) if(!(p.State<2) && this.GetSelChildren(p,and,clr,attr,A,first)) return true; 
-if(type&4 && this.GetSelChildren(this.XF,and,clr,attr,A,first)) return true;
-return first!=null ? false : A;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.IsSelected = function(row,col){
-if(!row){ var C = this.Cols[col]; return C && C.Selected;  }
-if(!col) return row.Selected&&this.SelAnd;
-return row.Selected && row[this.ACol+"Selected"] || this.SelectingCells<3&&row.Selected==1 || this.SelectingCells==4&&(row.Selected&1||this.Cols[col]&&this.Cols[col].Selected);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.SetAllSelected = function(sel,single){
-if(sel==this.AllSelected || !this.SelectAllType || single&&!(this.SelectAllType&(sel?4:2)) || sel==-1&&this.AllSelected==null) return;
-if(single){
-   if(sel) this.AllSelected = !this.GetSelRows(null,null,0); 
-   else this.AllSelected = this.SelectAllType&4 ? !this.GetSelRows(null,null,0) : null; 
-   }
-else if(sel==-1) this.AllSelected = !this.AllSelected;
-else this.AllSelected = sel;
-var F = this.GetFixedRows();
-for(var i=0;i<F.length;i++) if(F[i].Kind!="Filter") this.UpdatePanel(F[i]);
-}
-// -----------------------------------------------------------------------------------------------------------
-// Marks given row as Selected
-TGP.SelectRow = function(row,sel,test,nosave,noundo,always){
-if(!row || row.Page || row.Kind=="Header" || !this.Selecting || this.Locked["select"] || !always && !this.CanSelect(row,this.SelectingCells==2)) return false;
-if(this.SelectingSingle&2 && row.Selected&this.SelAnd && !nosave) return false;
-var sel3 = this.SelectingCells>=3, sel2 = this.SelectingCells==2, rsel2 = row.Selected==2 && !sel3;
-if(sel==null) sel = row.Selected&this.SelAnd?0:1;
-else if(!(row.Selected&this.SelAnd) == !sel && !rsel2) return false;
-if(Grids.OnSelect||Grids.OnSelected){ var CC = null; if(sel2) { CC = []; for(var c in this.Cols) if(row[c+"Selected"]!=sel) CC[CC.length] = c; } }
-if(Grids.OnSelect&&Grids.OnSelect(this,row,!sel,CC,test)) return false;
-if(test) return true;
-MS.Undo;
-if(this.Undo&2&&!noundo) { 
-   if(sel2) { 
-      for(var c in this.Cols) if(row[c+"Selected"]!=sel) this.AddUndo({Type:"Select",Row:row,Col:c,Sel:sel,OSel:row[c+"Selected"]});
-      }
-   else {
-      this.AddUndo({Type:"Select",Row:row,Sel:sel,OSel:rsel2?null:!sel}); 
-      if(rsel2) for(var c in this.Cols) if(row[c+"Selected"]) this.AddUndo({Type:"Select",Row:row,Col:c,Sel:null,OSel:row[c+"Selected"]}); 
-      }
-   }
-ME.Undo;
-if(this.ColorCursor&8 && !sel3){
-   var C = this.Cols, CR = [];
-   if(rsel2) {
-      if(sel) for(var c in C) { if(!row[c+"Selected"] && !C[c].SelectedCells++ && !nosave) this.ColorCursorRows(c,CR,8); }
-      else for(var c in C) { if(row[c+"Selected"] && !--C[c].SelectedCells && !nosave) this.ColorCursorRows(c,CR,8); }
-      }
-   else if(this.SelectingCells){
-      if(sel) for(var c in C) { if((C[c].CanSelect==1||C[c].CanSelect==3) && !C[c].SelectedCells++ && !nosave) this.ColorCursorRows(c,CR,8); }
-      else for(var c in C) { if((C[c].CanSelect==1||C[c].CanSelect==3) && !--C[c].SelectedCells && !nosave) this.ColorCursorRows(c,CR,8); }
-      }
-   }
-if(sel2) {
-   for(var c in this.Cols) if(row[c+"Selected"]!=sel) row[c+"Selected"] = sel;
-   row.Selected = sel ? 2 : 0;
-   }
-else {
-   if(rsel2) for(var c in this.Cols) if(row[c+"Selected"]) row[c+"Selected"] = null;
-   row.Selected = sel3 ? sel | (row.Selected&2) : sel;
-   }
-if(this.ColorCursor&8) this.ColorCursorCols(row,[],8);
-if(this.SelectingSingle && sel) {
-   if(this.SelectingSingle&4 && !this.SRow) for(var r=this.GetFirstVisible();r;r=this.GetNextVisible(r)){ if (r.Selected&this.SelAnd && r!=row && this.CanSelect(r)) { this.SRow = r; break; } }
-   if(this.SRow && this.SRow!=row) this.SelectRow(this.SRow,0,0,1);
-   this.SRow = row;
-   }
-if(this.SelectClass) this.RefreshRow(row); else this.ColorRow(row);
-if(!nosave) this.SetAllSelected(sel,1);
-this.UpdatePanel(row);
-if(!nosave){
-   if(this.SaveSelected) this.SaveCfg();
-   if(this.CalculateSelected) this.Calculate(1,1);
-   else if(this.DynamicSpan||this.Undo&2) this.CalculateSpaces(1);
-   if(this.AutoUpdate && (","+this.Source.Upload.Type+",").toLowerCase().indexOf("selected")>=0) this.UploadChanges(row);
-   }
-if(Grids.OnSelected) Grids.OnSelected(this,row,!sel,CC);
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Marks all rows according to select
-TGP.SelectAllRows = function(select,test,noundo){
-if(!this.Selecting || this.Locked["select"]) return false;
-if(this.SelectingSingle){
-   if(!this.SRow||test) return false;
-   if(!this.SelectRow(this.SRow,0,test)) return false;
-   this.SRow = null;
-   return true;
-   }
-var page = (this.Paging==3 || this.Paging&&!this.AllPages) && !(this.SelectAllType&16) ? this.GetFPage() : null;
-
-var sel = 0, unsel = 0, and = this.SelAnd;
-var vis = (this.ClearSelected&6)==6, typ = (page?2:0)|(this.ClearSelected&8?1:0), flt = this.ClearSelected&2; 
-for(var r=vis?this.GetFirstVisible(page,typ):this.GetFirst(page,typ);r;r=vis?this.GetNextVisible(r,typ):this.GetNext(r,typ)){
-   if(!this.CanSelect(r) || flt&&r.Filtered) continue; 
-   if(r.Selected&and){ sel++; if(unsel&&!test) break; }
-   else { unsel++; if(sel&&!test) break; }
-   }
-if(this.RemovedPages&&!page){
-   for(var r=vis?this.GetFirstVisible(this.RemovedPages,typ):this.GetFirst(this.RemovedPages,typ);r;r=vis?this.GetNextVisible(r,typ):this.GetNext(r,typ)){
-      if(!this.CanSelect(r) || flt&&r.Filtered) continue; 
-      if(r.Selected&and){ sel++; if(unsel&&!test) break; }
-      else { unsel++; if(sel&&!test) break; }
-      }
-   }
-if(select==null) select = !sel;
-if((select==0||select==-1) && sel==0 || (select==1||select==-1) && unsel==0) return false;
-if(Grids.OnSelectAll && Grids.OnSelectAll(this,select,2,test)) return test ? false : true;
-if(test) return select==-1 ? unsel+sel : (select ? unsel : sel);
-MS.Undo;
-if(this.Undo&2&&!noundo) {
-   var aundo = this.CanUndo()+this.CanRedo()*2;
-   this.UndoStart();
-   for(var r=this.GetFirstVisible(page,typ);r;r=this.GetNextVisible(r,typ)) {
-      if(this.CanSelect(r) && !(r.Selected&and) == select || select==-1) this.AddUndo({Type:"Select",Row:r,OSel:!!(r.Selected&and)});
-      }
-   this.UndoEnd();
-   
-   this.AddUndo({Type:"Select",Sel:select}); 
-   if(this.CanUndo()+this.CanRedo()*2!=aundo) this.CalculateSpaces(1);
-   }
-ME.Undo;
-
-if(this.RowCount<this.SynchroCount) this.SelectAllRowsT(select);
-else {
-   this.ShowMessage(this.GetText("SelectAll"));
-   var T = this; setTimeout(function(){ T.SelectAllRowsT(select);},10);
-   }
-return true;
-}   
-// -----------------------------------------------------------------------------------------------------------
-TGP.SelectAllRowsT = function(select,page){  
-var and = this.SelAnd; if(page==null && (this.Paging==3 || this.Paging&&!this.AllPages) && !(this.SelectAllType&16)) page = this.GetFPage();
-var vis = (this.ClearSelected&6)==6, typ = (page?2:0)|(this.ClearSelected&8?1:0), flt = this.ClearSelected&2; 
-for(var r=vis?this.GetFirstVisible(page,typ):this.GetFirst(page,typ);r;r=vis?this.GetNextVisible(r,typ):this.GetNext(r,typ)){
-   if(this.CanSelect(r) && (!flt||!r.Filtered) && !(r.Selected&and) == select || select==-1) this.SelectRow(r,null,0,1);
-   }
-if(this.RemovedPages && !page){
-   for(var r=vis?this.GetFirstVisible(this.RemovedPages,typ):this.GetFirst(this.RemovedPages,typ);r;r=vis?this.GetNextVisible(r,typ):this.GetNext(r,typ)){
-      if(this.CanSelect(r) && (!flt||!r.Filtered) && !(r.Selected&and) == select || select==-1) r.Selected = !r.Selected;
-      }
-   }
-if(this.ColorCursor&8 && this.SelectingCells){
-   for(var j=0,A=[this.XH,this.XF];j<2;j++) for(var r=A[j].firstChild;r;r=r.nextSibling) if(r.ColorCursor&8) { if(this.ColorCursor&16) this.RefreshRow(r); else this.ColorRow(r); }
-   }
-this.SetAllSelected(select);
-if(this.SaveSelected) this.SaveCfg();
-if(this.CalculateSelected) this.Calculate(1,1);
-if(this.AutoUpdate && (","+this.Source.Upload.Type+",").toLowerCase().indexOf("selected")>=0) this.UploadChanges();
-this.HideMessage();
-if(Grids.OnSelectedAll) Grids.OnSelectedAll(this,select,2);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSelectRow = function(F,T){ 
-var row = this.GetARow(F), ret = row ? this.SelectRow(row,1,T) : false; 
-MS.Animate; if(ret && !T) this.AnimRow(row,"Select"); ME.Animate;
-return ret;
-}
-// -----------------------------------------------------------------------------------------------------------  
-TGP.ActionDeselectRow = function(F,T){ 
-var row = this.GetARow(F), ret = row ? this.SelectRow(row,0,T) : false; 
-MS.Animate; if(ret && !T) this.AnimRow(row,"Deselect"); ME.Animate;
-return ret;
-}
-// -----------------------------------------------------------------------------------------------------------  
-TGP.ActionSelectRowRange = function(dummy,T){ var cnt = this.FRow ? this.SelectRange(this.FRow,null,this.ARow,null,1,null,T) : 0; return T ? cnt : !!cnt; }
-TGP.ActionDeselectRowRange = function(dummy,T){ var cnt = this.FRow ? this.SelectRange(this.FRow,null,this.ARow,null,0,null,T) : 0; return T ? cnt : !!cnt; }
-TGP.ActionInvertRowRangeFirst = function(dummy,T){ var cnt = this.FRow ? this.SelectRange(this.FRow,null,this.ARow,null,2,null,T) : 0; return T ? cnt : !!cnt; }
-TGP.ActionSelectFocusedRows = function(F,T){ var A = this.GetARanges(F?F&~2:1,0,1,1), cnt = A.length ? this.SelectRange(A[0][0],null,A[0][2],null,1,null,T) : 0; return T ? cnt : !!cnt; }
-TGP.ActionDeselectFocusedRows = function(F,T){ var A = this.GetARanges(F?F&~2:1,0,1,1), cnt = A.length ? this.SelectRange(A[0][0],null,A[0][2],null,0,null,T) : 0; return T ? cnt : !!cnt; }
-TGP.ActionInvertFocusedRowsFirst = function(F,T){  var A = this.GetARanges(F?F&~2:1,0,1,1), cnt = A.length ? this.SelectRange(A[0][0],null,A[0][2],null,2,null,T) : 0; return T ? cnt : !!cnt; }
-// -----------------------------------------------------------------------------------------------------------  
-TGP.ActionSelectAll = function(dummy,T){ return this.SelectAllRows(1,T); }
-TGP.ActionDeselectAll = function(dummy,T){ return this.SelectAllRows(0,T); }
-TGP.ActionInvertAll = function(dummy,T){ return this.SelectAllRows(-1,T); }   
-// -----------------------------------------------------------------------------------------------------------
-ME.Select;
diff --git a/Grid/Sort.js.bak b/Grid/Sort.js.bak
deleted file mode 100644
index 0383f20..0000000
--- a/Grid/Sort.js.bak
+++ /dev/null
@@ -1,668 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// Sorting
-// -----------------------------------------------------------------------------------------------------------
-MS.Autosort;
-// -----------------------------------------------------------------------------------------------------------
-// Sorts row inside its parent, if is given col, tests only this column
-// If show==true, moves row in html table
-TGP.SortRow = function(row,col,show){
-if(!this.Sorted || !this.AutoSort || !this.Sorting || row.Fixed || !this.Sort) return;
-if(col && this.Sort.search(new RegExp("(^|,)"+col+"($|,)"))<0) return; 
-var S = this.GetSort();
-var typ = [], white = [], codes = [];
-var dir = this.PrepareSort(S,this.Root,typ,white,codes);
-var par = row.parentNode,r, ss = this.GetSortString(row,S,dir,typ,white,codes);
-if(par.Page){
-   if(!this.Root.CanSort) return;
-   for(r=this.GetFirst();r;r=this.GetNextSibling(r,8)) if(ss<this.GetSortString(r,S,dir,typ,white,codes)) break; 
-   } 
-else {
-   if(!Get(par,"CanSort")) return;
-   for(r=par.firstChild;r;r=r.nextSibling) if(ss<this.GetSortString(r,S,dir,typ,white,codes)) break; 
-   }
-
-if(this.MoveRow) this.MoveRow(row,r?r.parentNode:(par.Page&&this.Paging!=3?null:par),r,show,null,1);
-MS.Pager; if(this.Paging && this.Paging!=3 && par.Page && (!row.previousSibling || !row.nextSibling)) { this.SetPageNames(); this.UpdatePager(); } ME.Pager;
-if(show) this.ScrollIntoView(row,col);
-}
-// -----------------------------------------------------------------------------------------------------------
-ME.Autosort;
-
-MS.Sort;
-// -----------------------------------------------------------------------------------------------------------
-function ToSortString(num){
-
-if(num>0){
-   var lg = Math.log(num)/100;
-   return lg>=0 ? lg+"" : "/"+(10+lg);  
-   }
-   
-if(num<0){
-   var lg = Math.log(-num)/100;
-   return lg>0 ? "-/"+(10-lg) : "-"+(-lg);
-   }
-
-if(num=="0") return ".";
-return num+"";
-}
-// -----------------------------------------------------------------------------------------------------------
-function NegativeString(str){
-if(str==="") return NegativeString.Empty;
-var s = "",len = str.length; if(len>20) len = 20;
-for(var i=0;i<len;i++){
-   s += String.fromCharCode(65535-str.charCodeAt(i));
-   }
-s += "\uFFFF";
-return s;
-}
-NegativeString.Empty = String.fromCharCode(65530);
-
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetSortString = function(r,S,dir,typ,white,codes){
-var cnt = S.length/2, s = ""; 
-var nosort = r.SortPos; if(nosort==null) nosort = r.Def.SortPos;
-if(nosort && !this.InGrouping) s = dir ? String.fromCharCode(65535-nosort) : String.fromCharCode(nosort);
-for(var i=0;i<cnt;i++) {
-   var v,cn,cc = r.Spanned && Is(r,"SortSpan") ? this.GetSpanCol(r,S[i*2]) : S[i*2], tp = typ[i]; 
-   if(tp&1){
-      cn = cc+"SortDescValue"; v = r[cn]; if(v==null) v = r.Def[cn];
-      if(v==null){ cn = cc+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }
-      }
-   else { cn = cc+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }         
-   if(v==null){
-      if(tp&24){ 
-         v = r[cc]; if(v==null) v = r.Def[cc]; 
-         MS.Range;
-         if(tp&8 && v && typeof(v)=="string"){ 
-            var vr = r[cc+"Range"]; if(vr==null) { vr = r.Def[cc+"Range"]; if(vr==null) vr = this.Cols[cc]["Range"]; }
-            if(vr){
-               v = v.split(this.Lang.Format.ValueSeparator);
-               v = tp&1 ? v[v.length-1] : v[0];
-               var vp = v.indexOf(this.Lang.Format.RangeSeparator);
-               if(vp>=0) v = tp&1 ? v.slice(vp+1)-0 : v.slice(0,vp)-0;
-               else v-=0;
-               }
-            }
-         ME.Range;   
-         }
-      else v = this.GetString(r,cc,tp&32?6:2); 
-      }
-   if(Grids.OnGetSortValue) { var tmp = Grids.OnGetSortValue(this,r,cc,this.InGrouping&&tp&24?this.GetString(r,cc,2):v,tp&1,this.InGrouping); if(tmp!=null) v = tmp; }
-   v = v==null ? "" : v+"";
-   
-   MS.CharCodes;
-   if(codes[i]) v = UseCharCodes(v,codes[i]);
-   ME.CharCodes;
-   if(!(tp&4)) v = tp&2 ? v.toLocaleLowerCase() : v.toLowerCase();
-   if(white[i]) v = v.replace(white[i],"");
-   if(tp&2) v = UseLocale(v);
-   if(dir==(tp&1)) { 
-      s += (tp&40 ? ToSortString(v) : v) + "  ";
-      }
-   else { 
-      s += (tp&40 && (v-0 || v=="0") ? ToSortString(-v) : NegativeString(v)) + "  ";
-      }
-   }
-return s;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetSort = function(){
-var S = this.Sort, N = [], C = this.Cols, dc = this.DefaultSort; 
-if(!S) {
-   if(dc) return [dc,0];
-   return null;
-   }
-S = (S+"").replace(/\s/g,"").split(",");
-for(var i=0;i<S.length;i++){
-   var col = S[i], tp = 0;
-   if(col.charAt(0)=='-'){ tp = 1; col = col.slice(1); }
-   if(C[col]||col=="id") { 
-      N[N.length] = col; 
-      N[N.length] = tp; 
-      if(dc==col) dc = null;
-      }
-   else {   
-      MS.Debug; this.Debug(2,"Unknown column ",col," in Sort"); ME.Debug;
-      }
-   }
-if(dc) { 
-   if(N.length>=(this.MaxSort!=null?this.MaxSort:this.MaxSortColumns)*2) {
-   	try{//****增加一个异常处理,避免出错
-      var CC = this.Cols[dc]; if(CC.Visible || CC.CanHide) N.length -= 2;
-    }catch (e) { }//***
-      }
-   N[N.length] = dc; N[N.length] = 0; 
-   }
-if(!N.length) return null;
-return N;   
-}
-
-// -----------------------------------------------------------------------------------------------------------
-TGP.PrepareSort = function(S,par,typ,white,codes){
-var cnt = S.length/2, D = par.Def; if(!D) D = { };
-
-for(var i=0;i<cnt;i++){
-   var col = S[i*2];
-   if(this.Group&&!this.InGrouping&&col==this.MainCol){ 
-      var oc = par==this.Root ? this.XB.firstChild.firstChild : par.firstChild;
-      if(oc) oc = oc[this.MainCol+"GroupOrig"];
-      if(!oc){
-         oc = par==this.Root ? this.XB.lastChild.lastChild : par.lastChild; 
-         if(oc) oc = oc[this.MainCol+"GroupOrig"];
-         }
-      if(oc) col = oc;
-      }
-   var C = this.Cols[col];
-   if(!C) return; 
-   var tp = S[i*2+1],n;
-   n = par[col+"LocaleCompare"]; if(n==null) n = D[col+"LocaleCompare"]; if(n==null) n = C["LocaleCompare"]; if(n) tp |= 2;
-   n = par[col+"CaseSensitive"]; if(n==null) n = D[col+"CaseSensitive"]; if(n==null) n = C["CaseSensitive"]; if(n) tp |= 4;
-   n = par[col+"RawSort"]; if(n==null) n = D[col+"RawSort"]; if(n==null) n = C["RawSort"]; if(n==1) tp |= 16; else if(n==2) tp |= 32;
-   n = par[col+"NumberSort"]; if(n==null) n = D[col+"NumberSort"]; if(n==null) n = C["NumberSort"];
-   if(n==2) {
-      tp |= 8;
-      for(var root=par==this.Root,b=root?this.XB.firstChild:par;b;b=b.nextSibling){
-         for(var r=b.firstChild,desc=tp&1,cn,v;r;r=r.nextSibling){
-            if(desc){
-               cn = col+"SortDescValue"; v = r[cn]; if(v==null) v = r.Def[cn];
-               if(v==null){ cn = col+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }
-               }
-            else { cn = col+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }     
-            if(v==null) v = r[col]; if(v==null) v = r.Def[col];
-            if(v&&!(v-0)) { tp &= ~8; b = null; break; }
-            }
-         if(!b||!root) break;
-         }
-      }
-   else if(n==1 || n==null && CAlignRight[C.Type]) tp |= 8;
-   typ[i] = tp;
-   n = par[col+"WhiteChars"]; if(n==null) n = D[col+"WhiteChars"]; if(n==null) n = C["WhiteChars"];
-   white[i] = n ? GetWhiteChars(n) : null;
-   MS.CharCodes;
-   n = par[col+"CharCodes"]; if(n==null) n = D[col+"CharCodes"]; if(n==null) n = C["CharCodes"];
-   codes[i] = n;
-   ME.CharCodes;
-   
-   n = par[col+"SortType"]; if(n==null) n = D[col+"SortType"]; if(n==null) n = C["SortType"];
-   if(n!=null) { typ[i] |= n&6; if(!(n&8)) white[i] = ""; }
-   }
-
-var dir = 0; 
-for(var i=0;i<cnt;i++){
-   if(!(typ[i]&8)) dir += typ[i]&1 ? -1 : 1;
-   }
-if(dir) dir = dir<0 ? 1 : 0;
-else dir = typ[0]&1;
-return dir;
-}
-// -----------------------------------------------------------------------------------------------------------
-MS.Tree;
-TGP.SortChildren = function(par,show,nochildren,S){
-if(!S) S = this.GetSort(); if(!S) return false;
-var changed = false, ingrouping = this.InGrouping;
-
-var typ = [], white = [], codes = [];
-var dir = this.PrepareSort(S,par,typ,white,codes);
-
-// --- children sort a filling sort strings ---
-MS.Debug; this.ContinueTimer("SortPrepare"); ME.Debug;
-var A = [], B = [], p = 0, r = par.firstChild, block = 0, bls = "", bli = 1000;
-if(r && r.CPage){ 
-   for(;r;r=r.nextSibling){ 
-      for(var rc=r.firstChild;rc;rc=rc.nextSibling){
-         if((!nochildren || ingrouping&&!Is(rc,"CanGroup")) && rc.firstChild && this.SortChildren(rc,show,0,S)) changed = true;
-         if(rc.Block) {
-            if(block>0) { if(rc.Block > block) { block = rc.Block; bls += dir ? "0" : "9"; } }
-            else { block = rc.Block; bls = this.GetSortString(rc,S,dir,typ,white,codes) + (bli++); }
-            }
-         A[p] = (block-->0 ? bls+(dir ? 10000+block : 9999-block) : this.GetSortString(rc,S,dir,typ,white,codes)) + "      " + p;
-         B[p++] = rc;
-         }
-      }
-   }
-else {
-   for(;r;r=r.nextSibling){
-      if(!nochildren && r.firstChild && this.SortChildren(r,show,0,S)) changed = true;
-      if(r.Block) {
-         if(block>0) { if(r.Block > block) { block = r.Block; bls += dir ? "0" : "9"; } }
-         else { block = r.Block; bls = this.GetSortString(r,S,dir,typ,white,codes) + (bli++); }
-         }
-      A[p] = (block-->0 ? bls+(dir ? 10000+block : 9999-block) : this.GetSortString(r,S,dir,typ,white,codes)) + "      " + p;
-      B[p++] = r;
-      }
-   }
-MS.Debug; this.StopTimer("SortPrepare"); ME.Debug;
-
-if(p<=1 || par.Page && !this.Root.CanSort || !par.Page && !Is(par,"CanSort")) return changed;
-
-MS.Debug; this.ContinueTimer("SortSort"); ME.Debug;
-A.sort();
-MS.Debug; this.StopTimer("SortSort"); ME.Debug;
-
-var C = [], alen = A.length, blen = B.length-1;
-for(var i=0;i<alen;i++){
-   
-   C[i] = dir ? B[A[blen-i].slice(A[blen-i].length-6)-0] : B[A[i].slice(A[i].length-6)-0];
-   }
-
-MS.Debug; this.ContinueTimer("SortUpdate"); ME.Debug;
-if(this.InGrouping){
-   if(BNN) for(var i=0;i<C.length;i++) par.removeChild(C[i]); 
-   for(var i=0;i<C.length;i++) par.appendChild(C[i]);
-   }
-else {   
-   MS.CPages;
-   this.CreateCPages(par,show,C);
-   MX.CPages;
-   MS._Debug;if(0){ ME._Debug; 
-   if(BNN) for(var i=0;i<C.length;i++) par.removeChild(C[i]); 
-   for(var i=0;i<C.length;i++) par.appendChild(C[i]);
-   if(show) this.ShowCPages(C);
-   MS._Debug;} ME._Debug; 
-   ME.CPages;
-   }
-MS.Debug; this.StopTimer("SortUpdate"); ME.Debug;
-
-changed = true; 
-return changed;
-}
-ME.Tree;
-// -----------------------------------------------------------------------------------------------------------
-// Sorts rows according to Sort settings
-// If show==true, shows changes
-// Returns true if some changes were done
-TGP.DoSort = function(show,nochildren){
-var S = this.GetSort(); if(!S) return false;
-
-MS.Debug; 
-this.Debug(4,"Sorting rows"); this.StartTimer("Sort"); 
-this.NullTimer("SortPrepare"); this.NullTimer("SortSort"); this.NullTimer("SortUpdate"); this.NullTimer("SortShow");
-ME.Debug;
-var changed = false;
-
-var typ = [], white = [], codes = [];
-var dir = this.PrepareSort(S,this.Root,typ,white,codes);
-
-// --- children sort a filling sort strings ---
-MS.Debug; this.ContinueTimer("SortPrepare"); ME.Debug;
-var A = [], B = [], p = 0, m = !!this.MainCol && !nochildren, block = 0, bls = "", ingrouping = this.InGrouping, bli = 1000;
-var lr = this.AutoPages ? this.GetLastDataRow(512) : null, rest = null; if(lr) while(!lr.parentNode.Page) lr = lr.parentNode; 
-for(var b=this.XB.firstChild;b;b=b.nextSibling){
-   for(var r=b.firstChild;r;r=r.nextSibling){
-      MS.Tree;
-      if((m||ingrouping&&!Is(r,"CanGroup") )&& r.firstChild && (r.firstChild.nextSibling || r.firstChild.firstChild) && this.SortChildren(r,show,nochildren,S)) changed = true;
-      ME.Tree;
-      if(r.Block) {
-         if(block>0) { if(r.Block > block) { block = r.Block; bls += dir ? "0" : "9"; } }
-         else if(!rest) { block = r.Block; bls = this.GetSortString(r,S,dir,typ,white,codes)+(bli++); }
-         }
-      A[p] = (block-->0 ? bls+(dir ? 10000+block : 9999-block) : rest ? rest : this.GetSortString(r,S,dir,typ,white,codes)) + "      " + p;
-      
-      B[p++] = r;
-      if(r==lr) rest = dir ? String.fromCharCode(1) : String.fromCharCode(65534); 
-      }
-   }
-MS.Debug; this.StopTimer("SortPrepare"); ME.Debug;
-
-if(p<=1 || !this.Root.CanSort){ 
-   if(this.Loading) this.SetBody(this.XB.firstChild);                   
-   if(this.Paging && this.Loading) this.CreatePages(); 
-   MS.Pager;
-   if(this.Paging && this.SetPageNames) this.SetPageNames(); 
-   ME.Pager;
-   MS.Debug; 
-   this.StopTimer("Sort"); 
-   if(show) this.Debug(4,"TreeGrid sorted in ",this.GetTimer("Sort")," ms (prepare: ",this.NullTimer("SortPrepare")," ms, sort: ",this.NullTimer("SortSort")," ms, update: ",this.NullTimer("SortUpdate")," ms)");
-   ME.Debug;
-   return changed; 
-   }
-
-// --- main sort ---
-MS.Debug; this.ContinueTimer("SortSort"); ME.Debug;
-A.sort();
-MS.Debug; this.StopTimer("SortSort"); ME.Debug;
-
-// --- Data update ---
-MS.Debug; this.ContinueTimer("SortUpdate"); ME.Debug;
-var body = this.XB.firstChild, blen = B.length-1, alen = A.length;
-var cnt = this.Paging ? this.PageLength : 0xffffffff, block = 0;
-this.SetBody(body);
-for(var i=0;i<alen;i++){ 
-   
-   var r = dir ? B[A[blen-i].slice(A[blen-i].length-6)-0] : B[A[i].slice(A[i].length-6)-0];
-   if(BNN) r.parentNode.removeChild(r); 
-   
-   MS.Paging;
-   if(r.Visible){
-      if(!cnt){
-         if(block>0) cnt++;
-         else {
-            cnt = this.PageLength;
-            body = body.nextSibling;
-            if(!body) body = this.AddBody(show); 
-            else this.SetBody(body); 
-            }
-         }
-      cnt--;
-      }
-   if(r.Block && r.Block > block) block = r.Block;
-   block--;   
-   ME.Paging;
-   
-   body.appendChild(r);   
-   }
-MS.Debug; this.StopTimer("SortUpdate"); ME.Debug;
-
-MS.Pager;
-if(this.Paging && this.SetPageNames) this.SetPageNames();
-ME.Pager;
-
-MS.Debug; this.ContinueTimer("SortShow"); ME.Debug;
-if(show){
-   var rev = this.ReversedTree, next = rev ? "previousSibling" : "nextSibling";
-   for(var j=this.FirstSec;j<=this.LastSec;j++){
-      var n = "r"+j, orr = j==1 && Grids.OnDisplaceRow!=null;  
-      for(var i=0;i<alen;i++){
-         
-         var r = dir ? B[A[blen-i].slice(A[blen-i].length-6)-0] : B[A[i].slice(A[i].length-6)-0];
-         if(r[n]){ 
-            var p = r[n].parentNode, ch = r.Hasch ? r[n][next] : null;
-            if(ch){ 
-               if(!rev) p.appendChild(r[n]);
-               p.appendChild(ch);
-               if(orr){
-                  for(var c=r.firstChild;c&&c.Level>r.Level;c=this.GetNext(c)) if(c.r1) Grids.OnDisplaceRow(this,c); 
-                  }
-               if(rev) p.appendChild(r[n]);
-               }
-            else p.appendChild(r[n]);
-            if(orr) Grids.OnDisplaceRow(this,r);
-            }
-         }
-      }
-   if(this.RowIndex) this.UpdateRowIndex();
-   }
-MS.Debug; this.StopTimer("SortShow"); ME.Debug;   
-
-MS.Paging;
-body = body.nextSibling;
-while(body){                    
-   var n = body.nextSibling;
-   this.DelBody(body);
-   body = n;
-   }
-ME.Paging;
-
-if(this.FRect){
-   var fr = this.FRect; 
-   if(fr[7]) {
-      for(var ff=this.GetFirstVisible(null,4);ff&&!this.CanFocus(ff,fr[1]);ff=this.GetNextVisible(ff,4));
-      for(var lr=this.GetLastVisible(null,4);lr&&!this.CanFocus(lr,fr[1]);lr=this.GetPrevVisible(lr,4));
-      this.Focus(this.FRow,this.FCol,this.FPagePos,[ff,fr[1],lr,fr[3],null,null,fr[6],1],0); 
-      }
-   }
-
-changed = true; 
-MS.Debug; 
-this.StopTimer("Sort"); 
-if(show) this.Debug(4,"TreeGrid sorted in ",this.GetTimer("Sort")," ms (prepare: ",this.NullTimer("SortPrepare")," ms, sort: ",this.NullTimer("SortSort")," ms, update: ",this.NullTimer("SortUpdate")," ms, show: ",this.NullTimer("SortShow")," ms)");
-ME.Debug;
-
-//lertTimer();
-return changed;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Main function - sorts all rows and shows changes
-TGP.SortRows = function(){
-var T = this;
-MS.Paging;
-if(!this.AllPages && this.OnePage&1 && this.Paging){ 
-   var FP = this.GetFPage();
-   if(this.ChildParts){
-      MS.ChildParts;
-      this.SortChildren(FP,false,0);
-      this.ClearPage(FP);
-      FP.State=2;
-      this.RenderPage(FP);
-      ME.ChildParts;
-      }
-   else {   
-      MS.Tree;
-      this.SortChildren(FP,true,0);
-      if(this.MainCol) for(var r=FP.firstChild;r;r=r.nextSibling) this.UpdateChildrenLevelImg(r,true);
-      ME.Tree;
-      }
-   return;
-   }
-
-if(this.Paging==3 && this.Root.CanSort){
-   this.ShowMessage(this.GetText("Sort"));
-   this.ReloadBody(null,0,"Sort");
-   return;
-   }
-
-if(this.Paging || this.ChildParts || this.DynamicBorder){ 
-   var em = this.EditMode;   if(em && this.EndEdit(1)==-1) return;
-   this.ShowMessage(this.GetText("Sort"));
-   if(this.ShowFocused && this.Focused==null) this.SetFocused();
-   setTimeout(function(){
-      if(T.DoSort()){ 
-         MS.Debug; T.Debug(4,"TreeGrid sorted in ",T.GetTimer("Sort")," ms (prepare: ",T.NullTimer("SortPrepare")," ms, sort: ",T.NullTimer("SortSort")," ms, update: ",T.NullTimer("SortUpdate")," ms, show: ",T.NullTimer("SortShow")," ms)"); ME.Debug;
-         
-         MS.Gantt; if(T.GanttDependency){ T.RefreshGantt(16); } ME.Gantt;    
-         MS.Chart; if(T.Charts) T.UpdateCharts(); ME.Chart;
-         T.RenderBody(0,em);
-         }
-      else T.HideMessage();
-      if(Grids.OnSortFinish) Grids.OnSortFinish(T);
-      },10);
-   return;
-   }
-ME.Paging;
-function sort(){ 
-   if(T.ShowFocused && T.Focused==null) T.SetFocused();
-   if(T.DoSort(true)){ T.UpdateAllLevelImg(true); T.ReColor(); }
-   T.HideMessage();
-   if(T.ShowFocused) T.FocusFocused();
-   else {
-      if(T.FRow && !T.FRow.Fixed) T.ScrollIntoView(T.FRow,T.FCol);
-      if(T.FRow) T.ExpandParents(T.FRow);
-      }
-   
-   MS.Gantt; if(T.GanttDependency){ T.RefreshGantt(17); } ME.Gantt;    
-   MS.Chart; if(T.Charts) T.UpdateCharts(); ME.Chart;
-   T.UpdateCursors(1);
-   if(Grids.OnSortFinish) Grids.OnSortFinish(T);
-   }
-if(this.RowCount<this.SynchroCount) sort();
-else { this.ShowMessage(this.GetText("Sort")); setTimeout(sort,10); }
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ChangeSort = function(cols,nosort,tmp,nosync,noundo){
-if(!cols) cols = "";
-if(typeof(cols)=="object") cols = cols.join(""); 
-if(typeof(nosort)=="object"){ 
-   var types = nosort; nosort = tmp;
-   cols = SplitToArray(cols);
-   types = SplitToArray(types);
-   for(var i=0;i<types.length;i++) if(types[i]) cols[i] = "-"+cols[i];
-   }
-if(this.Undo&16&&!noundo) this.AddUndo({Type:"Sort",OSort:this.Sort,Sort:cols}); 
-this.Sort = cols;
-this.UpdateHeader();
-this.SaveCfg();
-if(!nosort) this.SortRows();
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.ChangeSort(cols,nosort,tmp,1);
-      }
-   }
-ME.Sync;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.SetSort = function(col,sort,nosync){
-if(this.Disabled || !this.Sorting || this.EditMode && this.EndEdit(1)==-1 || this.Locked["sort"]) return false;
-var nosort = 1;
-if(this.Sorted){
-   nosort = Grids.OnSort ? Grids.OnSort(this,col,sort) : 0;
-   if(nosort==-1) return true; 
-   }
-if(!nosort && this.Paging==3 && this.Root.CanSort && !(this.OnePage&1) && !this.CanReload()) return false; 
-if(this.Undo&16) this.AddUndo({Type:"Sort",OSort:this.Sort,Sort:sort}); 
-this.Sort = sort;
-this.UpdateHeader();
-this.SaveCfg();
-if(!nosort) this.SortRows();   
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.SetSort(col,sort,1);
-      }
-   }
-ME.Sync;
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetSortCol = function(col,row){
-var C = this.Cols[col];
-if(!this.Sorting || !C || C.Type=="Pass" || C.Type=="Panel") return null;
-if(!row) return C.CanSort&1 ? col : null;
-var sc = row[col+"SortCol"]; if(sc==null&&row.Def) sc = row.Def[col+"SortCol"]; if(sc==="") return null;
-if(sc&&this.Cols[sc]) col = sc;
-return this.Cols[col].CanSort&1 ? col : null;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Fires on sort icon in column
-TGP.SortClick = function(col,dir,test){
-if(!this.Sorting||!col||this.Locked["sort"]) return false;
-var S = this.GetSort(), C = this.Cols;
-if(!S) S = []; var cnt = S.length, N = [];
-for(var i=0;i<cnt&&!C[S[i]].Visible&&!C[S[i]].CanHide&&S[i]!=this.DefaultSort;i+=2) N[N.length] = (S[i+1]?"-":"")+S[i]; 
-if(S[i]==col && S[i+1]==dir) return false; 
-if(test) return true;
-N[N.length] = (dir?"-":"") + col;
-var msc = (this.MaxSort!=null?this.MaxSort:this.MaxSortColumns)*2+i-2;
-for(;i<cnt&&i<msc;i+=2) {
-   if(S[i]!=col) N[N.length] = (S[i+1]?"-":"")+S[i];
-   else msc += 2;
-   }
-return this.SetSort(col,N.join(","));
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortAsc = function(F,T){ var A = this.GetACell(F); return A ? this.SortClick(this.GetSortCol(A[1],A[0]),0,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortDesc = function(F,T){ var A = this.GetACell(F); return A ? this.SortClick(this.GetSortCol(A[1],A[0]),1,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortAscOne = function(F,T){ 
-var A = this.GetACell(F); if(!A) return false;
-var col = this.GetSortCol(A[1],A[0]);
-if(!this.Sorting || !col || this.Sort==col) return false;
-if(T) return true;
-return this.SetSort(col,col);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortDescOne = function(F,T){ 
-var A = this.GetACell(F); if(!A) return false;
-var col = this.GetSortCol(A[1],A[0]);
-if(!this.Sorting || !col || this.Sort=="-"+col) return false;
-if(T) return true;
-return this.SetSort(col,"-"+col);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.SortAdd = function(col,dir,time,test){ 
-if(!col) return false;
-var t = new Date()-0, sort;
-if(!time || t - this.SortClickTime < time) { 
-   var S = new RegExp("(^|,)-?"+col+"($|,)");
-   if(this.Sort && this.Sort.search(S)>=0){ 
-      var odir = this.Sort.search(new RegExp("(^|,)-"+col+"($|,)"))>=0;
-      if(odir == dir) return false;
-      sort = this.Sort.replace(S,function(dummy,b,c){ return (b?b:"")+(dir?"-":"")+col+(c?c:""); });
-      }
-   else { 
-      if(this.Sort&&this.Sort.split(",").length>=(this.MaxSort!=null?this.MaxSort:this.MaxSortColumns)) return false;
-      sort = (this.Sort?this.Sort+",":"")+(dir?"-":"")+col;
-      }
-   }
-else sort = dir?"-"+col:col;
-if(test) return true;
-this.SortClickTime = t;
-return this.SetSort(col,sort);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortAscAdd = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),0,2000,T) : false; }
-TGP.ActionSortDescAdd = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),1,2000,T) : false; }
-TGP.ActionSortAscAppend = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),0,0,T) : false; }
-TGP.ActionSortDescAppend = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),1,0,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionNoSort = function(F,T){ 
-var A = this.GetACell(F); if(!A) return false;
-var col = this.GetSortCol(A[1],A[0]); if(!col) return false;
-var S = new RegExp("(^|,)-?"+col+"($|,)");
-if(!this.Sorting||!this.Sort || this.Sort.search(S)<0) return false;
-if(T) return true;
-var sort = this.Sort.replace(S,function(dummy,b,c){ return b==","&&c==","?",":""; } );
-return this.SetSort(col,sort); 
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionDefaultSort = function(dummy,T){ 
-if(this.Sort==this.OrigSort) return false; 
-if(T) return true;
-return this.SetSort(null,this.OrigSort);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortOff = function(dummy,T,nosync,noundo){
-if(!this.Sorting || !this.Sorted || this.Locked["sort"]) return false;
-if(T) return true;
-if(this.Undo&16&&!noundo) this.AddUndo({Type:"Sorted",OSorted:1,Sorted:0});
-this.Sorted = false;
-this.SaveCfg();
-this.Calculate(1,1,1);
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.ActionSortOff(0,0,1);
-      }
-   }
-ME.Sync;
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortOn = function(dummy,T,nosync,noundo){
-if(!this.Sorting || this.Sorted || this.Locked["sort"]) return false;
-if(T) return true;
-var sort = true;
-if(Grids.OnSort) { sort = !Grids.OnSort(this,null,this.Sort); if(sort==-1) return false; }
-if(sort && this.Paging==3 && this.Root.CanSort && !this.CanReload()) return false;
-if(this.Undo&16&&!noundo) this.AddUndo({Type:"Sorted",OSorted:0,Sorted:1});
-this.Sorted = true;
-if(sort){ 
-   if(this.Paging==3 && this.Root.CanSort){
-      MS.Paging;
-      T = this;
-      setTimeout(function(){
-         T.ReSortNeeded = true;
-         T.ReloadBody(function(){ T.ReSortNeeded = false; },0,"ReSort");
-         },10);
-      ME.Paging;            
-      }
-   else this.SortRows();   
-   }
-this.SaveCfg();
-this.Calculate(1,1,1);
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.ActionSortOn(null,0,1);
-      }
-   }
-ME.Sync;
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-ME.Sort;
diff --git a/Grid/Sort.js.bak.bak b/Grid/Sort.js.bak.bak
deleted file mode 100644
index ba6d59d..0000000
--- a/Grid/Sort.js.bak.bak
+++ /dev/null
@@ -1,668 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// Sorting
-// -----------------------------------------------------------------------------------------------------------
-MS.Autosort;
-// -----------------------------------------------------------------------------------------------------------
-// Sorts row inside its parent, if is given col, tests only this column
-// If show==true, moves row in html table
-TGP.SortRow = function(row,col,show){
-if(!this.Sorted || !this.AutoSort || !this.Sorting || row.Fixed || !this.Sort) return;
-if(col && this.Sort.search(new RegExp("(^|,)"+col+"($|,)"))<0) return; 
-var S = this.GetSort();
-var typ = [], white = [], codes = [];
-var dir = this.PrepareSort(S,this.Root,typ,white,codes);
-var par = row.parentNode,r, ss = this.GetSortString(row,S,dir,typ,white,codes);
-if(par.Page){
-   if(!this.Root.CanSort) return;
-   for(r=this.GetFirst();r;r=this.GetNextSibling(r,8)) if(ss<this.GetSortString(r,S,dir,typ,white,codes)) break; 
-   } 
-else {
-   if(!Get(par,"CanSort")) return;
-   for(r=par.firstChild;r;r=r.nextSibling) if(ss<this.GetSortString(r,S,dir,typ,white,codes)) break; 
-   }
-
-if(this.MoveRow) this.MoveRow(row,r?r.parentNode:(par.Page&&this.Paging!=3?null:par),r,show,null,1);
-MS.Pager; if(this.Paging && this.Paging!=3 && par.Page && (!row.previousSibling || !row.nextSibling)) { this.SetPageNames(); this.UpdatePager(); } ME.Pager;
-if(show) this.ScrollIntoView(row,col);
-}
-// -----------------------------------------------------------------------------------------------------------
-ME.Autosort;
-
-MS.Sort;
-// -----------------------------------------------------------------------------------------------------------
-function ToSortString(num){
-
-if(num>0){
-   var lg = Math.log(num)/100;
-   return lg>=0 ? lg+"" : "/"+(10+lg);  
-   }
-   
-if(num<0){
-   var lg = Math.log(-num)/100;
-   return lg>0 ? "-/"+(10-lg) : "-"+(-lg);
-   }
-
-if(num=="0") return ".";
-return num+"";
-}
-// -----------------------------------------------------------------------------------------------------------
-function NegativeString(str){
-if(str==="") return NegativeString.Empty;
-var s = "",len = str.length; if(len>20) len = 20;
-for(var i=0;i<len;i++){
-   s += String.fromCharCode(65535-str.charCodeAt(i));
-   }
-s += "\uFFFF";
-return s;
-}
-NegativeString.Empty = String.fromCharCode(65530);
-
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetSortString = function(r,S,dir,typ,white,codes){
-var cnt = S.length/2, s = ""; 
-var nosort = r.SortPos; if(nosort==null) nosort = r.Def.SortPos;
-if(nosort && !this.InGrouping) s = dir ? String.fromCharCode(65535-nosort) : String.fromCharCode(nosort);
-for(var i=0;i<cnt;i++) {
-   var v,cn,cc = r.Spanned && Is(r,"SortSpan") ? this.GetSpanCol(r,S[i*2]) : S[i*2], tp = typ[i]; 
-   if(tp&1){
-      cn = cc+"SortDescValue"; v = r[cn]; if(v==null) v = r.Def[cn];
-      if(v==null){ cn = cc+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }
-      }
-   else { cn = cc+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }         
-   if(v==null){
-      if(tp&24){ 
-         v = r[cc]; if(v==null) v = r.Def[cc]; 
-         MS.Range;
-         if(tp&8 && v && typeof(v)=="string"){ 
-            var vr = r[cc+"Range"]; if(vr==null) { vr = r.Def[cc+"Range"]; if(vr==null) vr = this.Cols[cc]["Range"]; }
-            if(vr){
-               v = v.split(this.Lang.Format.ValueSeparator);
-               v = tp&1 ? v[v.length-1] : v[0];
-               var vp = v.indexOf(this.Lang.Format.RangeSeparator);
-               if(vp>=0) v = tp&1 ? v.slice(vp+1)-0 : v.slice(0,vp)-0;
-               else v-=0;
-               }
-            }
-         ME.Range;   
-         }
-      else v = this.GetString(r,cc,tp&32?6:2); 
-      }
-   if(Grids.OnGetSortValue) { var tmp = Grids.OnGetSortValue(this,r,cc,this.InGrouping&&tp&24?this.GetString(r,cc,2):v,tp&1,this.InGrouping); if(tmp!=null) v = tmp; }
-   v = v==null ? "" : v+"";
-   
-   MS.CharCodes;
-   if(codes[i]) v = UseCharCodes(v,codes[i]);
-   ME.CharCodes;
-   if(!(tp&4)) v = tp&2 ? v.toLocaleLowerCase() : v.toLowerCase();
-   if(white[i]) v = v.replace(white[i],"");
-   if(tp&2) v = UseLocale(v);
-   if(dir==(tp&1)) { 
-      s += (tp&40 ? ToSortString(v) : v) + "  ";
-      }
-   else { 
-      s += (tp&40 && (v-0 || v=="0") ? ToSortString(-v) : NegativeString(v)) + "  ";
-      }
-   }
-return s;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetSort = function(){
-var S = this.Sort, N = [], C = this.Cols, dc = this.DefaultSort; 
-if(!S) {
-   if(dc) return [dc,0];
-   return null;
-   }
-S = (S+"").replace(/\s/g,"").split(",");
-for(var i=0;i<S.length;i++){
-   var col = S[i], tp = 0;
-   if(col.charAt(0)=='-'){ tp = 1; col = col.slice(1); }
-   if(C[col]||col=="id") { 
-      N[N.length] = col; 
-      N[N.length] = tp; 
-      if(dc==col) dc = null;
-      }
-   else {   
-      MS.Debug; this.Debug(2,"Unknown column ",col," in Sort"); ME.Debug;
-      }
-   }
-if(dc) { 
-   if(N.length>=(this.MaxSort!=null?this.MaxSort:this.MaxSortColumns)*2) {
-   	try{//****增加一个异常处理,避免出氏
-      var CC = this.Cols[dc]; if(CC.Visible || CC.CanHide) N.length -= 2;
-    }catch (e) { }//***
-      }
-   N[N.length] = dc; N[N.length] = 0; 
-   }
-if(!N.length) return null;
-return N;   
-}
-
-// -----------------------------------------------------------------------------------------------------------
-TGP.PrepareSort = function(S,par,typ,white,codes){
-var cnt = S.length/2, D = par.Def; if(!D) D = { };
-
-for(var i=0;i<cnt;i++){
-   var col = S[i*2];
-   if(this.Group&&!this.InGrouping&&col==this.MainCol){ 
-      var oc = par==this.Root ? this.XB.firstChild.firstChild : par.firstChild;
-      if(oc) oc = oc[this.MainCol+"GroupOrig"];
-      if(!oc){
-         oc = par==this.Root ? this.XB.lastChild.lastChild : par.lastChild; 
-         if(oc) oc = oc[this.MainCol+"GroupOrig"];
-         }
-      if(oc) col = oc;
-      }
-   var C = this.Cols[col];
-   if(!C) return; 
-   var tp = S[i*2+1],n;
-   n = par[col+"LocaleCompare"]; if(n==null) n = D[col+"LocaleCompare"]; if(n==null) n = C["LocaleCompare"]; if(n) tp |= 2;
-   n = par[col+"CaseSensitive"]; if(n==null) n = D[col+"CaseSensitive"]; if(n==null) n = C["CaseSensitive"]; if(n) tp |= 4;
-   n = par[col+"RawSort"]; if(n==null) n = D[col+"RawSort"]; if(n==null) n = C["RawSort"]; if(n==1) tp |= 16; else if(n==2) tp |= 32;
-   n = par[col+"NumberSort"]; if(n==null) n = D[col+"NumberSort"]; if(n==null) n = C["NumberSort"];
-   if(n==2) {
-      tp |= 8;
-      for(var root=par==this.Root,b=root?this.XB.firstChild:par;b;b=b.nextSibling){
-         for(var r=b.firstChild,desc=tp&1,cn,v;r;r=r.nextSibling){
-            if(desc){
-               cn = col+"SortDescValue"; v = r[cn]; if(v==null) v = r.Def[cn];
-               if(v==null){ cn = col+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }
-               }
-            else { cn = col+"SortValue"; v = r[cn]; if(v==null) v = r.Def[cn]; }     
-            if(v==null) v = r[col]; if(v==null) v = r.Def[col];
-            if(v&&!(v-0)) { tp &= ~8; b = null; break; }
-            }
-         if(!b||!root) break;
-         }
-      }
-   else if(n==1 || n==null && CAlignRight[C.Type]) tp |= 8;
-   typ[i] = tp;
-   n = par[col+"WhiteChars"]; if(n==null) n = D[col+"WhiteChars"]; if(n==null) n = C["WhiteChars"];
-   white[i] = n ? GetWhiteChars(n) : null;
-   MS.CharCodes;
-   n = par[col+"CharCodes"]; if(n==null) n = D[col+"CharCodes"]; if(n==null) n = C["CharCodes"];
-   codes[i] = n;
-   ME.CharCodes;
-   
-   n = par[col+"SortType"]; if(n==null) n = D[col+"SortType"]; if(n==null) n = C["SortType"];
-   if(n!=null) { typ[i] |= n&6; if(!(n&8)) white[i] = ""; }
-   }
-
-var dir = 0; 
-for(var i=0;i<cnt;i++){
-   if(!(typ[i]&8)) dir += typ[i]&1 ? -1 : 1;
-   }
-if(dir) dir = dir<0 ? 1 : 0;
-else dir = typ[0]&1;
-return dir;
-}
-// -----------------------------------------------------------------------------------------------------------
-MS.Tree;
-TGP.SortChildren = function(par,show,nochildren,S){
-if(!S) S = this.GetSort(); if(!S) return false;
-var changed = false, ingrouping = this.InGrouping;
-
-var typ = [], white = [], codes = [];
-var dir = this.PrepareSort(S,par,typ,white,codes);
-
-// --- children sort a filling sort strings ---
-MS.Debug; this.ContinueTimer("SortPrepare"); ME.Debug;
-var A = [], B = [], p = 0, r = par.firstChild, block = 0, bls = "", bli = 1000;
-if(r && r.CPage){ 
-   for(;r;r=r.nextSibling){ 
-      for(var rc=r.firstChild;rc;rc=rc.nextSibling){
-         if((!nochildren || ingrouping&&!Is(rc,"CanGroup")) && rc.firstChild && this.SortChildren(rc,show,0,S)) changed = true;
-         if(rc.Block) {
-            if(block>0) { if(rc.Block > block) { block = rc.Block; bls += dir ? "0" : "9"; } }
-            else { block = rc.Block; bls = this.GetSortString(rc,S,dir,typ,white,codes) + (bli++); }
-            }
-         A[p] = (block-->0 ? bls+(dir ? 10000+block : 9999-block) : this.GetSortString(rc,S,dir,typ,white,codes)) + "      " + p;
-         B[p++] = rc;
-         }
-      }
-   }
-else {
-   for(;r;r=r.nextSibling){
-      if(!nochildren && r.firstChild && this.SortChildren(r,show,0,S)) changed = true;
-      if(r.Block) {
-         if(block>0) { if(r.Block > block) { block = r.Block; bls += dir ? "0" : "9"; } }
-         else { block = r.Block; bls = this.GetSortString(r,S,dir,typ,white,codes) + (bli++); }
-         }
-      A[p] = (block-->0 ? bls+(dir ? 10000+block : 9999-block) : this.GetSortString(r,S,dir,typ,white,codes)) + "      " + p;
-      B[p++] = r;
-      }
-   }
-MS.Debug; this.StopTimer("SortPrepare"); ME.Debug;
-
-if(p<=1 || par.Page && !this.Root.CanSort || !par.Page && !Is(par,"CanSort")) return changed;
-
-MS.Debug; this.ContinueTimer("SortSort"); ME.Debug;
-A.sort();
-MS.Debug; this.StopTimer("SortSort"); ME.Debug;
-
-var C = [], alen = A.length, blen = B.length-1;
-for(var i=0;i<alen;i++){
-   
-   C[i] = dir ? B[A[blen-i].slice(A[blen-i].length-6)-0] : B[A[i].slice(A[i].length-6)-0];
-   }
-
-MS.Debug; this.ContinueTimer("SortUpdate"); ME.Debug;
-if(this.InGrouping){
-   if(BNN) for(var i=0;i<C.length;i++) par.removeChild(C[i]); 
-   for(var i=0;i<C.length;i++) par.appendChild(C[i]);
-   }
-else {   
-   MS.CPages;
-   this.CreateCPages(par,show,C);
-   MX.CPages;
-   MS._Debug;if(0){ ME._Debug; 
-   if(BNN) for(var i=0;i<C.length;i++) par.removeChild(C[i]); 
-   for(var i=0;i<C.length;i++) par.appendChild(C[i]);
-   if(show) this.ShowCPages(C);
-   MS._Debug;} ME._Debug; 
-   ME.CPages;
-   }
-MS.Debug; this.StopTimer("SortUpdate"); ME.Debug;
-
-changed = true; 
-return changed;
-}
-ME.Tree;
-// -----------------------------------------------------------------------------------------------------------
-// Sorts rows according to Sort settings
-// If show==true, shows changes
-// Returns true if some changes were done
-TGP.DoSort = function(show,nochildren){
-var S = this.GetSort(); if(!S) return false;
-
-MS.Debug; 
-this.Debug(4,"Sorting rows"); this.StartTimer("Sort"); 
-this.NullTimer("SortPrepare"); this.NullTimer("SortSort"); this.NullTimer("SortUpdate"); this.NullTimer("SortShow");
-ME.Debug;
-var changed = false;
-
-var typ = [], white = [], codes = [];
-var dir = this.PrepareSort(S,this.Root,typ,white,codes);
-
-// --- children sort a filling sort strings ---
-MS.Debug; this.ContinueTimer("SortPrepare"); ME.Debug;
-var A = [], B = [], p = 0, m = !!this.MainCol && !nochildren, block = 0, bls = "", ingrouping = this.InGrouping, bli = 1000;
-var lr = this.AutoPages ? this.GetLastDataRow(512) : null, rest = null; if(lr) while(!lr.parentNode.Page) lr = lr.parentNode; 
-for(var b=this.XB.firstChild;b;b=b.nextSibling){
-   for(var r=b.firstChild;r;r=r.nextSibling){
-      MS.Tree;
-      if((m||ingrouping&&!Is(r,"CanGroup") )&& r.firstChild && (r.firstChild.nextSibling || r.firstChild.firstChild) && this.SortChildren(r,show,nochildren,S)) changed = true;
-      ME.Tree;
-      if(r.Block) {
-         if(block>0) { if(r.Block > block) { block = r.Block; bls += dir ? "0" : "9"; } }
-         else if(!rest) { block = r.Block; bls = this.GetSortString(r,S,dir,typ,white,codes)+(bli++); }
-         }
-      A[p] = (block-->0 ? bls+(dir ? 10000+block : 9999-block) : rest ? rest : this.GetSortString(r,S,dir,typ,white,codes)) + "      " + p;
-      
-      B[p++] = r;
-      if(r==lr) rest = dir ? String.fromCharCode(1) : String.fromCharCode(65534); 
-      }
-   }
-MS.Debug; this.StopTimer("SortPrepare"); ME.Debug;
-
-if(p<=1 || !this.Root.CanSort){ 
-   if(this.Loading) this.SetBody(this.XB.firstChild);                   
-   if(this.Paging && this.Loading) this.CreatePages(); 
-   MS.Pager;
-   if(this.Paging && this.SetPageNames) this.SetPageNames(); 
-   ME.Pager;
-   MS.Debug; 
-   this.StopTimer("Sort"); 
-   if(show) this.Debug(4,"TreeGrid sorted in ",this.GetTimer("Sort")," ms (prepare: ",this.NullTimer("SortPrepare")," ms, sort: ",this.NullTimer("SortSort")," ms, update: ",this.NullTimer("SortUpdate")," ms)");
-   ME.Debug;
-   return changed; 
-   }
-
-// --- main sort ---
-MS.Debug; this.ContinueTimer("SortSort"); ME.Debug;
-A.sort();
-MS.Debug; this.StopTimer("SortSort"); ME.Debug;
-
-// --- Data update ---
-MS.Debug; this.ContinueTimer("SortUpdate"); ME.Debug;
-var body = this.XB.firstChild, blen = B.length-1, alen = A.length;
-var cnt = this.Paging ? this.PageLength : 0xffffffff, block = 0;
-this.SetBody(body);
-for(var i=0;i<alen;i++){ 
-   
-   var r = dir ? B[A[blen-i].slice(A[blen-i].length-6)-0] : B[A[i].slice(A[i].length-6)-0];
-   if(BNN) r.parentNode.removeChild(r); 
-   
-   MS.Paging;
-   if(r.Visible){
-      if(!cnt){
-         if(block>0) cnt++;
-         else {
-            cnt = this.PageLength;
-            body = body.nextSibling;
-            if(!body) body = this.AddBody(show); 
-            else this.SetBody(body); 
-            }
-         }
-      cnt--;
-      }
-   if(r.Block && r.Block > block) block = r.Block;
-   block--;   
-   ME.Paging;
-   
-   body.appendChild(r);   
-   }
-MS.Debug; this.StopTimer("SortUpdate"); ME.Debug;
-
-MS.Pager;
-if(this.Paging && this.SetPageNames) this.SetPageNames();
-ME.Pager;
-
-MS.Debug; this.ContinueTimer("SortShow"); ME.Debug;
-if(show){
-   var rev = this.ReversedTree, next = rev ? "previousSibling" : "nextSibling";
-   for(var j=this.FirstSec;j<=this.LastSec;j++){
-      var n = "r"+j, orr = j==1 && Grids.OnDisplaceRow!=null;  
-      for(var i=0;i<alen;i++){
-         
-         var r = dir ? B[A[blen-i].slice(A[blen-i].length-6)-0] : B[A[i].slice(A[i].length-6)-0];
-         if(r[n]){ 
-            var p = r[n].parentNode, ch = r.Hasch ? r[n][next] : null;
-            if(ch){ 
-               if(!rev) p.appendChild(r[n]);
-               p.appendChild(ch);
-               if(orr){
-                  for(var c=r.firstChild;c&&c.Level>r.Level;c=this.GetNext(c)) if(c.r1) Grids.OnDisplaceRow(this,c); 
-                  }
-               if(rev) p.appendChild(r[n]);
-               }
-            else p.appendChild(r[n]);
-            if(orr) Grids.OnDisplaceRow(this,r);
-            }
-         }
-      }
-   if(this.RowIndex) this.UpdateRowIndex();
-   }
-MS.Debug; this.StopTimer("SortShow"); ME.Debug;   
-
-MS.Paging;
-body = body.nextSibling;
-while(body){                    
-   var n = body.nextSibling;
-   this.DelBody(body);
-   body = n;
-   }
-ME.Paging;
-
-if(this.FRect){
-   var fr = this.FRect; 
-   if(fr[7]) {
-      for(var ff=this.GetFirstVisible(null,4);ff&&!this.CanFocus(ff,fr[1]);ff=this.GetNextVisible(ff,4));
-      for(var lr=this.GetLastVisible(null,4);lr&&!this.CanFocus(lr,fr[1]);lr=this.GetPrevVisible(lr,4));
-      this.Focus(this.FRow,this.FCol,this.FPagePos,[ff,fr[1],lr,fr[3],null,null,fr[6],1],0); 
-      }
-   }
-
-changed = true; 
-MS.Debug; 
-this.StopTimer("Sort"); 
-if(show) this.Debug(4,"TreeGrid sorted in ",this.GetTimer("Sort")," ms (prepare: ",this.NullTimer("SortPrepare")," ms, sort: ",this.NullTimer("SortSort")," ms, update: ",this.NullTimer("SortUpdate")," ms, show: ",this.NullTimer("SortShow")," ms)");
-ME.Debug;
-
-//lertTimer();
-return changed;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Main function - sorts all rows and shows changes
-TGP.SortRows = function(){
-var T = this;
-MS.Paging;
-if(!this.AllPages && this.OnePage&1 && this.Paging){ 
-   var FP = this.GetFPage();
-   if(this.ChildParts){
-      MS.ChildParts;
-      this.SortChildren(FP,false,0);
-      this.ClearPage(FP);
-      FP.State=2;
-      this.RenderPage(FP);
-      ME.ChildParts;
-      }
-   else {   
-      MS.Tree;
-      this.SortChildren(FP,true,0);
-      if(this.MainCol) for(var r=FP.firstChild;r;r=r.nextSibling) this.UpdateChildrenLevelImg(r,true);
-      ME.Tree;
-      }
-   return;
-   }
-
-if(this.Paging==3 && this.Root.CanSort){
-   this.ShowMessage(this.GetText("Sort"));
-   this.ReloadBody(null,0,"Sort");
-   return;
-   }
-
-if(this.Paging || this.ChildParts || this.DynamicBorder){ 
-   var em = this.EditMode;   if(em && this.EndEdit(1)==-1) return;
-   this.ShowMessage(this.GetText("Sort"));
-   if(this.ShowFocused && this.Focused==null) this.SetFocused();
-   setTimeout(function(){
-      if(T.DoSort()){ 
-         MS.Debug; T.Debug(4,"TreeGrid sorted in ",T.GetTimer("Sort")," ms (prepare: ",T.NullTimer("SortPrepare")," ms, sort: ",T.NullTimer("SortSort")," ms, update: ",T.NullTimer("SortUpdate")," ms, show: ",T.NullTimer("SortShow")," ms)"); ME.Debug;
-         
-         MS.Gantt; if(T.GanttDependency){ T.RefreshGantt(16); } ME.Gantt;    
-         MS.Chart; if(T.Charts) T.UpdateCharts(); ME.Chart;
-         T.RenderBody(0,em);
-         }
-      else T.HideMessage();
-      if(Grids.OnSortFinish) Grids.OnSortFinish(T);
-      },10);
-   return;
-   }
-ME.Paging;
-function sort(){ 
-   if(T.ShowFocused && T.Focused==null) T.SetFocused();
-   if(T.DoSort(true)){ T.UpdateAllLevelImg(true); T.ReColor(); }
-   T.HideMessage();
-   if(T.ShowFocused) T.FocusFocused();
-   else {
-      if(T.FRow && !T.FRow.Fixed) T.ScrollIntoView(T.FRow,T.FCol);
-      if(T.FRow) T.ExpandParents(T.FRow);
-      }
-   
-   MS.Gantt; if(T.GanttDependency){ T.RefreshGantt(17); } ME.Gantt;    
-   MS.Chart; if(T.Charts) T.UpdateCharts(); ME.Chart;
-   T.UpdateCursors(1);
-   if(Grids.OnSortFinish) Grids.OnSortFinish(T);
-   }
-if(this.RowCount<this.SynchroCount) sort();
-else { this.ShowMessage(this.GetText("Sort")); setTimeout(sort,10); }
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ChangeSort = function(cols,nosort,tmp,nosync,noundo){
-if(!cols) cols = "";
-if(typeof(cols)=="object") cols = cols.join(""); 
-if(typeof(nosort)=="object"){ 
-   var types = nosort; nosort = tmp;
-   cols = SplitToArray(cols);
-   types = SplitToArray(types);
-   for(var i=0;i<types.length;i++) if(types[i]) cols[i] = "-"+cols[i];
-   }
-if(this.Undo&16&&!noundo) this.AddUndo({Type:"Sort",OSort:this.Sort,Sort:cols}); 
-this.Sort = cols;
-this.UpdateHeader();
-this.SaveCfg();
-if(!nosort) this.SortRows();
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.ChangeSort(cols,nosort,tmp,1);
-      }
-   }
-ME.Sync;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.SetSort = function(col,sort,nosync){
-if(this.Disabled || !this.Sorting || this.EditMode && this.EndEdit(1)==-1 || this.Locked["sort"]) return false;
-var nosort = 1;
-if(this.Sorted){
-   nosort = Grids.OnSort ? Grids.OnSort(this,col,sort) : 0;
-   if(nosort==-1) return true; 
-   }
-if(!nosort && this.Paging==3 && this.Root.CanSort && !(this.OnePage&1) && !this.CanReload()) return false; 
-if(this.Undo&16) this.AddUndo({Type:"Sort",OSort:this.Sort,Sort:sort}); 
-this.Sort = sort;
-this.UpdateHeader();
-this.SaveCfg();
-if(!nosort) this.SortRows();   
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.SetSort(col,sort,1);
-      }
-   }
-ME.Sync;
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetSortCol = function(col,row){
-var C = this.Cols[col];
-if(!this.Sorting || !C || C.Type=="Pass" || C.Type=="Panel") return null;
-if(!row) return C.CanSort&1 ? col : null;
-var sc = row[col+"SortCol"]; if(sc==null&&row.Def) sc = row.Def[col+"SortCol"]; if(sc==="") return null;
-if(sc&&this.Cols[sc]) col = sc;
-return this.Cols[col].CanSort&1 ? col : null;
-}
-// -----------------------------------------------------------------------------------------------------------
-// Fires on sort icon in column
-TGP.SortClick = function(col,dir,test){
-if(!this.Sorting||!col||this.Locked["sort"]) return false;
-var S = this.GetSort(), C = this.Cols;
-if(!S) S = []; var cnt = S.length, N = [];
-for(var i=0;i<cnt&&!C[S[i]].Visible&&!C[S[i]].CanHide&&S[i]!=this.DefaultSort;i+=2) N[N.length] = (S[i+1]?"-":"")+S[i]; 
-if(S[i]==col && S[i+1]==dir) return false; 
-if(test) return true;
-N[N.length] = (dir?"-":"") + col;
-var msc = (this.MaxSort!=null?this.MaxSort:this.MaxSortColumns)*2+i-2;
-for(;i<cnt&&i<msc;i+=2) {
-   if(S[i]!=col) N[N.length] = (S[i+1]?"-":"")+S[i];
-   else msc += 2;
-   }
-return this.SetSort(col,N.join(","));
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortAsc = function(F,T){ var A = this.GetACell(F); return A ? this.SortClick(this.GetSortCol(A[1],A[0]),0,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortDesc = function(F,T){ var A = this.GetACell(F); return A ? this.SortClick(this.GetSortCol(A[1],A[0]),1,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortAscOne = function(F,T){ 
-var A = this.GetACell(F); if(!A) return false;
-var col = this.GetSortCol(A[1],A[0]);
-if(!this.Sorting || !col || this.Sort==col) return false;
-if(T) return true;
-return this.SetSort(col,col);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortDescOne = function(F,T){ 
-var A = this.GetACell(F); if(!A) return false;
-var col = this.GetSortCol(A[1],A[0]);
-if(!this.Sorting || !col || this.Sort=="-"+col) return false;
-if(T) return true;
-return this.SetSort(col,"-"+col);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.SortAdd = function(col,dir,time,test){ 
-if(!col) return false;
-var t = new Date()-0, sort;
-if(!time || t - this.SortClickTime < time) { 
-   var S = new RegExp("(^|,)-?"+col+"($|,)");
-   if(this.Sort && this.Sort.search(S)>=0){ 
-      var odir = this.Sort.search(new RegExp("(^|,)-"+col+"($|,)"))>=0;
-      if(odir == dir) return false;
-      sort = this.Sort.replace(S,function(dummy,b,c){ return (b?b:"")+(dir?"-":"")+col+(c?c:""); });
-      }
-   else { 
-      if(this.Sort&&this.Sort.split(",").length>=(this.MaxSort!=null?this.MaxSort:this.MaxSortColumns)) return false;
-      sort = (this.Sort?this.Sort+",":"")+(dir?"-":"")+col;
-      }
-   }
-else sort = dir?"-"+col:col;
-if(test) return true;
-this.SortClickTime = t;
-return this.SetSort(col,sort);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortAscAdd = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),0,2000,T) : false; }
-TGP.ActionSortDescAdd = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),1,2000,T) : false; }
-TGP.ActionSortAscAppend = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),0,0,T) : false; }
-TGP.ActionSortDescAppend = function(F,T){ var A = this.GetACell(F); return A ? this.SortAdd(this.GetSortCol(A[1],A[0]),1,0,T) : false; }
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionNoSort = function(F,T){ 
-var A = this.GetACell(F); if(!A) return false;
-var col = this.GetSortCol(A[1],A[0]); if(!col) return false;
-var S = new RegExp("(^|,)-?"+col+"($|,)");
-if(!this.Sorting||!this.Sort || this.Sort.search(S)<0) return false;
-if(T) return true;
-var sort = this.Sort.replace(S,function(dummy,b,c){ return b==","&&c==","?",":""; } );
-return this.SetSort(col,sort); 
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionDefaultSort = function(dummy,T){ 
-if(this.Sort==this.OrigSort) return false; 
-if(T) return true;
-return this.SetSort(null,this.OrigSort);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortOff = function(dummy,T,nosync,noundo){
-if(!this.Sorting || !this.Sorted || this.Locked["sort"]) return false;
-if(T) return true;
-if(this.Undo&16&&!noundo) this.AddUndo({Type:"Sorted",OSorted:1,Sorted:0});
-this.Sorted = false;
-this.SaveCfg();
-this.Calculate(1,1,1);
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.ActionSortOff(0,0,1);
-      }
-   }
-ME.Sync;
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.ActionSortOn = function(dummy,T,nosync,noundo){
-if(!this.Sorting || this.Sorted || this.Locked["sort"]) return false;
-if(T) return true;
-var sort = true;
-if(Grids.OnSort) { sort = !Grids.OnSort(this,null,this.Sort); if(sort==-1) return false; }
-if(sort && this.Paging==3 && this.Root.CanSort && !this.CanReload()) return false;
-if(this.Undo&16&&!noundo) this.AddUndo({Type:"Sorted",OSorted:0,Sorted:1});
-this.Sorted = true;
-if(sort){ 
-   if(this.Paging==3 && this.Root.CanSort){
-      MS.Paging;
-      T = this;
-      setTimeout(function(){
-         T.ReSortNeeded = true;
-         T.ReloadBody(function(){ T.ReSortNeeded = false; },0,"ReSort");
-         },10);
-      ME.Paging;            
-      }
-   else this.SortRows();   
-   }
-this.SaveCfg();
-this.Calculate(1,1,1);
-MS.Sync;
-if(this.Sync["sort"] && !nosync){
-   for(var i=0;i<Grids.length;i++){
-      var G = Grids[i];
-      if(G&&G!=this&&!G.Loading&&G.SyncId==this.SyncId&&G.Sync["sort"]) G.ActionSortOn(null,0,1);
-      }
-   }
-ME.Sync;
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-ME.Sort;
diff --git a/Grid/UpdateGrid.js.bak b/Grid/UpdateGrid.js.bak
deleted file mode 100644
index 847c23b..0000000
--- a/Grid/UpdateGrid.js.bak
+++ /dev/null
@@ -1,1086 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// Update grid on start
-// -----------------------------------------------------------------------------------------------------------
-// -----------------------------------------------------------------------------------------------------------
-// Continue of AfterLoad()
-// Updates grid setting after all data was loaded
-TGP.UpdateGrid = function(sync,cnt){
-if(!this.Loading) return;
-
-if(!document.body.offsetWidth && !this.Print && !this.Hidden){ 
-   var T = this; setTimeout(function(){ T.UpdateGrid(sync,cnt);},100);
-   return;
-   }
-
-if((!this.Img.Loaded||!this.Img.DialogLoaded||this.Gantt&&!this.Img.GanttLoaded) && !this.Hidden) {
-   if(!this.Img.Style){
-      MS.Debug; this.Debug(0,"No CSS style and url defined by <Cfg Style='' CSS=''"+(this.Gantt?" GanttCSS=''":"")+"/> "); ME.Debug;
-      this.Alert("StyleErr");
-      this.ShowStartErr(null,1);
-      return;
-      }
-   if(!this.CacheTimeout) this.CacheTimeout = 0; 
-   MS.Debug; if(!this.Timers["Styles"] && !sync) { this.Debug(sync?2:4,"Loading styles"); this.StartTimer("Styles"); } ME.Debug;
-   if(!cnt) cnt = 1;
-   else cnt++; 
-   if(this.CacheTimeout*10<cnt || sync&&!BOpera&&location.protocol!="file:"){
-      MS.Debug; this.Debug(0,"Cannot load CSS style from ",this.GetUrl(this.Img.Loaded?(this.Img.DialogLoaded?this.GanttCSS:this.DialogCSS):this.CSS)); ME.Debug;
-      this.Alert("StyleErr");
-      this.ShowStartErr(null,1);
-      return;
-      }
-   MS.Message; if(!this.SuppressMessage) { this.HideMessage(); ShowMessageCenter(this.GetText("LoadStyles"),this.MainTag,"GridMessage",null,this.MessageWidth); } ME.Message;
-   var T = this; setTimeout(function(){ T.MeasureHTML(); if(T.Gantt) T.MeasureGanttHTML(); T.UpdateGrid(sync,cnt); },100);
-   return;
-   }
-
-MS.Lang;
-var ln = this.Reset&&this.Reset.Language!=null ? this.Reset.Language : this.Language;
-if(ln) { 
-   this.Language = (ln+"").toUpperCase();
-   if(!this.Trans) this.Trans = this.Text[this.Language]; 
-   }
-ME.Lang;
-
-MS.Animate;
-if(BIEA&&!BIEA10) { this.AnimateCols = 0; this.AnimateRows = 0; this.AnimateCells = 0; this.AnimateUndo = 0; this.AnimateDialogs = 0; }
-ME.Animate;
-
-if(!this.DefCols.Space) this.DefCols.Space = this.DefCols.C;
-if(BIEA&&!BIEA10||BIPAD) this.AbsoluteCursors |= 7; 
-
-this.UpdateLockedValues();
-if(this.Protected&&(this.Locked+"").search(/\bedit\b/)<0) this.Locked = this.Locked ? this.Locked+",Edit" : "Edit";
-this.SetLocked(this.Locked,1);
-
-if(this.File){
-   this.RowIndexType = (this.RowIndexType&1) | 46;
-   this.ColIndexType |= (this.ColIndexType&1) | 30;
-   this.FormulaType |= 56;
-   this.FormulaRelative = 1;
-   this.FormulaLocal = 0;
-   
-   }
-
-if(this.ExcelDates&&this.Gantt) { this.ExcelDates = 0; this.Debug(2,"ExcelDates cannot be used with Gantt chart!"); }
-if(this.Lang.Format.ExcelDates!=null && !this.ExcelDates != !this.Lang.Format.ExcelDates && Grids.length>1) this.Debug(2,"ExcelDates must be set in all grids the same!");
-if(this.ExcelDates){ this.Lang.Format.ExcelDates = 1; this.Lang.Format.GMT = 1; }
-else this.Lang.Format.ExcelDates = 0;
-
-this.SetMergeUndo(this.UndoMerge);
-
-if(this.DynamicSpan==2){
-   for(var c in this.DefCols) this.DefCols[c].Spanned = 1;
-   for(var c in this.Cols) if(this.Cols[c].Spanned==null) this.Cols[c].Spanned = 1;
-   for(var n in this.Def) this.Def[n].Spanned = 1;
-   }
-
-MS.ReversedTree; if(this.ReversedTree) { this.ReversedTree = 0; this.SetReversedTree(1,2); } ME.ReversedTree;
-if(this.ReversedColTree==null) this.ReversedColTree = this.ColTree==4 ? 1 : 0;
-else if(this.ColTree>=3) this.ColTree = this.ReversedColTree ? 4 : 3;
-
-if(this.AutoRows && this.Paging!=3){
-   var B = this.XB.lastChild; if(!B) B = this.AddBody();
-   for(var i=0;i<this.AutoRows;i++) B.appendChild(Dom.createElement("I"));
-   }
-
-MS.Index$UpCounter;
-if(this.RowIndex) { 
-   this.NoRowIndex = "NoIndex"; 
-   
-   }
-else if(this.UpCounter){ this.RowIndex = this.UpCounter; this.RowIndexType = this.UpCounterType; this.NoRowIndex = "NoUpCounter"; } 
-if(this.RowIndex && !this.Cols[this.RowIndex]) { var C = this.AddCol(this.RowIndex,0,0,{Def:"Index",NoUpload:2}); C.Visible = 1; if(this.RowIndexWidth) C.Width = this.RowIndexWidth; }
-ME.Index$UpCounter;
-
-
-MS.Gantt;
-MS.GanttResources; 
-if(this.GanttResourcesMaster){
-   var G = Grids[this.GanttResourcesMaster];
-   if(!G || G.Loading){ 
-      this.ShowMessage(this.GetText("Load"));
-      var T = this; setTimeout(function(){ T.UpdateGrid(sync,cnt); },500);
-      return;
-      }
-   this.ResourcesGrid = G;
-   this.InitResources();
-   }
-ME.GanttResources; 
-ME.Gantt;
-
-MS.Pivot;
-if(this.PivotMaster){ 
-   var G = Grids[this.PivotMaster];
-   if(!this.Source.PivotLoading){
-      if(!G || G.Loading){ 
-         this.ShowMessage(this.GetText("Load"));
-         var T = this; setTimeout(function(){ T.UpdateGrid(sync,cnt); },500);
-         return;
-         }
-      this.PivotGrid = G;
-      if(this.CreatePivot()) return;
-      else {
-         this.PivotGrid = null;
-         if(this.Loading) this.AddBody();
-         else this.AddPage();
-         this.Adding = 0; this.Editing = 0; this.Deleting = 0;
-         }
-      }
-   else {
-      this.PivotGrid = G;
-      if(!G.PivotDetail) G.PivotDetail = {};
-      G.PivotDetail[this.id] = this; 
-      this.Source.PivotLoading = 0;
-      }
-   }
-else if(Grids.HasPivotDetail){
-   for(var i=0;i<Grids.length;i++) if(Grids[i] && Grids[i].PivotMaster==this.id && Grids[i].PivotGrid) Grids[i].PivotGrid = this; 
-   }
-ME.Pivot;
-   
-if(!this.Hidden && !this.SuppressMessage) this.MainTag.innerHTML = ""; 
-if(this.Source.Nested) this.Source.Defaults.Bonus = null;
-
-MS.Debug; if(this.Timers["Styles"]) this.Debug(4,"Styles loaded in ",this.EndTimer("Styles")," ms"); ME.Debug;
-
-MS.Debug; this.Debug(4,"Updating layout and values"); this.StartTimer("Update"); this.StartTimer("UpdateGrid"); ME.Debug;
-MS._Debug; if(0){ ME._Debug;
- this.DynamicStyle = null; 
- this.DynamicBorder = null; 
-MS._Debug; } ME._Debug; 
-this.SelAnd = this.SelectingCells==1||this.SelectingCells==2 ? 3 : 1; 
-if(this.SelectingCols==null) this.SelectingCols = this.ColSelecting;  
-if(this.PrintZoomFit && (BIEA&&!BIEA9||BSafari&&!BChrome)) this.PrintZoomFit = 0;
-if(this.MacContextMenu==null) this.MacContextMenu = !!this.Gantt;
-if(this.PrintLocation==null) this.PrintLocation = window==window.top ? 3 : 0;
-if(this.ShowPrintPageBreaks===""||this.ShowPrintPageBreaks==null) this.ShowPrintPageBreaks = -1;
-if(BFF48) this.FastPanel = 0;
-if(BIE) this.ExactWidth = 0; 
-if(BChrome&&this.Scale&&this.Scale!=1&&this.Overlay&&!this.ChromeTable) this.ChromeTable = -1;
-
-// --- Correction of main tag settings ---
-if(!this.Hidden){
-   this.UpdateMainTag();
-   this.GetMainTagSize(1);
-   }
-
-MS._Debug;if(0){ ME._Debug; 
-MS.Tree; 
-if(this.MainCol&&this.GanttSheet()) { if(this.MainCol!="Index") NoModule("Tree","Grid"); this.MainCol = "###"; this.HideTree = 1; }
-if(this.ColTree&&this.GanttSheet()) this.ColTree = null;
-MX.Tree; 
-if(this.MainCol){ if(this.MainCol!="Index") NoModule("Tree","Grid"); this.MainCol = null; } 
-ME.Tree;
-MS.Paging; MX.Paging; if(this.Paging){ this.Paging = 0; NoModule("Paging"); } ME.Paging;
- if((this.AutoCols||this.AutoColPages) && !this.ColNames[1].length){ this.AutoColPages = 0; this.AutoPages = 0; NoModule(this.AutoCols?"Index":"PagingAuto","Sheet"); } 
-MS._Debug; } ME._Debug; 
-
-if(!this.Paging) this.AllPages = 1;
-if(this.RemoveCollapsed > this.ChildPaging) this.RemoveCollapsed = this.ChildPaging;
-
-MS._Debug;if(0){ ME._Debug; MS.Panel; MX.Panel; if(this.Panel) this.Panel.Visible = 0; ME.Panel; MS._Debug; } ME._Debug;
-
-var A = this.Actions;
-MS.Edit;
-var em = this.InEditMode;
-if(em!=null){
-   
-   //.OnClickCell = em==1 ? "Focus AND StartEdit" : "ChangeFocus OR Focus AND StartEdit";
-   A.OnDblClickCell = em==1 ? "" : "Focus AND StartEdit";
-   A.OnKey = em==0 ? "0" : "!StartEdit";
-   A.OnBackspace = em==0 ? "0" : "!StartEdit";
-   }
-var en = this.EnterMode;
-if(en){
-   if(en==1){ A.OnEnterEdit="AcceptEdit AND TabDownEdit,1"; A.OnEnter="TabDownEdit"; }
-   if(en==2){ A.OnEnterEdit="AcceptEdit AND GoDownEditAdd,1"; A.OnEnter="GoDownEditAdd"; }
-   if(en==3){ A.OnEnterEdit="AcceptEdit AND TabRightEdit,1"; A.OnEnter="TabRightEdit"; }
-   if(en==4){ A.OnEnterEdit="AcceptEdit AND TabRightEditAdd,1"; A.OnEnter="TabRightEditAdd"; }
-   }
-MS.FocusRect;
-var fr = this.FocusRect;
-if(fr&16){
-   A.OnDragLeftEdge="MoveFocus"; A.OnDragRightEdge="MoveFocus"; A.OnDragTopEdge="MoveFocus"; A.OnDragBottomEdge="MoveFocus";
-   A.OnCtrlDragLeftEdge="CopyFocus"; A.OnCtrlDragRightEdge="CopyFocus"; A.OnCtrlDragTopEdge="CopyFocus"; A.OnCtrlDragBottomEdge="CopyFocus";
-   A.OnShiftDragLeftEdge="MoveFocusValues"; A.OnShiftDragRightEdge="MoveFocusValues"; A.OnShiftDragTopEdge="MoveFocusValues"; A.OnShiftDragBottomEdge="MoveFocusValues";
-   A.OnShiftCtrlDragLeftEdge="CopyFocusValues"; A.OnShiftCtrlDragRightEdge="CopyFocusValues"; A.OnShiftCtrlDragTopEdge="CopyFocusValues"; A.OnShiftCtrlDragBottomEdge="CopyFocusValues";
-   if(this.FocusCellBorderCursor==null) this.FocusCellBorderCursor = 1;
-   }
-ME.FocusRect;
-if(this.ExternalEdit) { 
-   var E = this.ExternalEdit.split(","), r = this.GetRowById(E[0]), c = E[1]; 
-   if(r&&c) {
-      this.ExternalEdit = [r,c]; r.ExternalEdit = c;
-      if(r[c+"OnClick"]==null) r[c+"OnClick"] = "var sa=Grid.SuppressAnimations;Grid.SuppressAnimations=1;AcceptEdit;"+(BTablet?"Grid.ARow=Grid.Rows['"+r.id+"'];":"")+"StartEditCell;Grid.SuppressAnimations=sa;return 1";
-      }
-   }
-if(this.ExternalFocus) { 
-   var E = this.ExternalFocus.split(","), r = this.GetRowById(E[0]), c = E[1]; 
-   if(r&&c) {
-      this.ExternalFocus = [r,c]; r.ExternalFocus = c;
-      if(r[c+"OnClick"]==null) r[c+"OnClick"] = "AcceptEdit,StartEditCellEmpty,1";
-      if(r[c+"OnEnter"]==null) r[c+"OnEnter"] = "AcceptEdit";
-      }
-   }
-
-ME.Edit;
-if(this.MomentumScroll&&!BTouch) this.MomentumScroll = 0;
-if((this.MomentumScroll&3)==3&&BIPAD&&!BIPAD8) this.MomentumScroll = 1; 
-MS.CustomScroll; if(Grids.HiddenScroll==2 && !this.CustomScroll) { this.CustomScroll = 3; if(!this.CustomHScroll) this.CustomHScroll = 3; } ME.CustomScroll; 
-if(this.ScrollParent && typeof(this.ScrollParent)=="string") this.ScrollParent = GetElem(this.ScrollParent);
-
-
-MS._Reg;
-MX._Reg;
-MS.Cfg;
-if(Grids.Stat==null){
-   if(this.NoStat) Grids.Stat = 0;
-   else {
-      var T = this; Grids.Stat = 1; Grids.StatTime = 0;
-      setTimeout(function(){
-         try { 
-            if(Grids.Stat<10) return; 
-            if(T.Cleared) {
-               for(var i=0;i<Grids.length;i++) if(Grids[i]&&!Grids[i].Cleared) { T = Grids[i]; break; }
-               if(T.Cleared) return;
-               }
-            var DS = document.createElement("div"), cc = "Comrsient"; DS.className = T.Img.Style+"Stat"; DS.style.width = "0px"; DS.style.height = "0px"; DS.style.overflow = "hidden";
-            var O = new TCfg(), v = self[cc.slice(0,3)+"pon"+cc.slice(6)]; v = v ? v["Ve"+cc.slice(3,6)+"on"] : 0; v = v ? v.split(".") : [0]; 
-            if(v[0]=="0") return; 
-            O.SetInt6(((v[0]-0?v[0]-13:0)&7)+(v[1]&7)*8);
-            O.SetInt6((v[2]&31)+(T.Gantt?32:0));
-            O.SetInt6((BEdge?1:BIEA11?2:BIEA10?3:BIEA9?4:BIEA8?5:BIEA6?7:BIE?8:BIE5?9:BIEA?6:BAndroid?10:BIPAD?11:BMozilla?12:BChrome?13:BSafariWin?14:BSafariMac?15:BOpera?16:0)+(BStrict?0:32)); 
-            var A = GetWindowSize(); 
-            O.SetInt6((((A[0]>1500?1500:A[0])/100)&15)+(T.Cookie?16:0)+(T.TestIds?32:0)); 
-            O.SetInt6((((A[1]>1500?1500:A[1])/100)&15)+(T.MainCol?16:0)+(T.Toolbar.Visible?32:0)); 
-            A = [T.MainTag.offsetWidth,T.MainTag.offsetHeight]; 
-            O.SetInt6((((A[0]>1500?1500:A[0])/100)&15)+(T.DebugFlags["info"]?3:T.DebugFlags["problem"]?2:T.DebugFlags["error"]?1:0)*16); 
-            O.SetInt6((((A[1]>1500?1500:A[1])/100)&15)+(T.DebugLevel?16:0)+(T.SuppressAnimations||!T.AnimateRows&&!T.AnimateCols&&!T.AnimateCells?32:0)); 
-            for(var rc=0,lc=(T.LoadedCount-1)>>3;lc>0;lc>>=1,rc++);
-            O.SetInt6(((rc>15?15:rc)&15)+(T.Source.Sync?16:0)+(Requests.Sync?32:0)); 
-            for(rc=0,lc=(T.RowCount-1)>>3;lc>0;lc>>=1,rc++);
-            O.SetInt6(((rc>15?15:rc)&15)+(Grids.SafeCSS?16:0)+(T.PersistentCfg?32:0)); 
-            for(var i=0,lc=0;i<T.ColNames.length;i++) lc += T.ColNames[i].length;
-            for(rc=0,lc--;lc>0;lc>>=1,rc++);
-            O.SetInt6(((rc>15?15:rc)&7)+(T.Rtl?16:0)+(T.Lang.Format.Hirji?32:0)); 
-            O.SetInt6((T.Paging&3)+(T.ChildPaging&3)*4+(T.ColPaging?16:0)+(T.ChildParts?32:0)); 
-            O.SetInt6((T.RemoveUnusedPages&3)+(T.AllPages?4:0)+(T.MaxPages?8:0)+(T.MaxChildParts?16:0)+(T.MaxColPages?32:0)); 
-            O.SetInt6((T.RemoveCollapsed&3)+(T.Pager.Visible?4:0)+(T.Pagers.length>1?8:0)+(T.ChildPartMin?16:0)+(T.ColPagingFixed?32:0)); 
-            O.SetInt6((T.FastPages?1:0)+(T.PageLengthDiv>1?2:0)+(T.OnePage?4:0)+(T.ExactSize?8:0)+(T.MaxHeight?16:0)+(T.LimitScroll?32:0));
-            O.SetInt6((T.NoScroll?1:0)+(T.ResizingMain?2:0)+(T.SectionResizing&&(T.LeftCanResize||T.RightCanResize)?4:0)+(T.StaticCursor?8:0)+(T.FocusRect?16:0)+(T.FocusWholeRow?32:0));
-            O.SetInt6((T.Source.Upload.Url?1:T.Source.Upload.Tag?2:T.Source.Upload.Data?3:0)+(T.AutoUpdate?4:0)+(T.Source.Upload.Format.toLowerCase()=="json"?8:0)+(T.Source.Check.Url?16:0)+(T.Source.Cell.Url?32:0));
-            O.SetInt6((T.Source.Data.Url?1:0)+(Grids.OnCustomAjax?2:0)+(T.NoHScroll?4:0)+(T.NoVScroll?8:0)+(T.CustomScroll?16:0)+(T.ReversedTree?32:0));
-            O.SetInt6((T.FormulaEditing&3)+(T.FormulaRelative&3)*4+(T.RowSpan?16:0)+(T.DynamicSpan?32:0)); 
-            O.SetInt6((T.DynamicStyle?1:0)+(T.DynamicBorder?2:0)+(T.DynamicFormat?4:0)+(T.ExcelDates?8:0)+(T.File?16:0)+(T.Lang.Format.GMT?32:0));
-            O.SetInt6((T.Adding||T.Deleting?1:0)+(T.ColAdding||T.ColDeleting?2:0)+(T.Dragging?4:0)+(T.Selecting?8:0)+(T.SelectingCells?16:0)+(T.SelectingCols?32:0));
-            O.SetInt6((T.Editing?1:0)+(T.PrintLoad?2:0)+(T.ExportLoad?4:0)+(T.PrintZoomFit?8:0)+(T.Source.ExportPDF.Url?16:0)+(T.SuppressCfg?32:0));
-            O.SetInt6((T.DetailGrid||T.MasterGrid?1:0)+(T.NestedGrid?2:0)+(T.PivotMaster||T.PivotGrid?4:0)+(T.Undo?8:0)+(T.Charts?16:0)+(T.SuppressMessage?32:0));
-            var S = {"TS":1,"TW":2,"TM":3,"TB":4,"TT":5,"CB":6,"CC":7,"CE":8,"CG":9,"CL":10,"CO":11,"CQ":12,"CF":13,"CR":14,"CS":15,"CP":16}[T.Img.Style];
-            O.SetInt6((S?S:0)+(T.CSS?32:0)); 
-            var i = 0;
-            if(T.Scale && T.Scale!=1){
-               var s = T.Scale, ss = [0,0,0.5,0.6,0.75,0.9,1,1.1,1.25,1.5,2,3,4,5,10,100];
-               for(var i=1;i<ss.length;i++) if(s<1?s<ss[i]:s<=ss[i]) { i--; break; }
-               }
-            O.SetInt6(i+(T.ScaleX?16:0)+(T.ScaleY?32:0)); 
-            var S = {"Tiny":1,"Mini":2,"Small":3,"Low":4,"Normal":5,"Wide":6,"High":7,"Big":8,"Giant":9}[T.Size];
-            var d = 0; MS._Debug; d = 1; ME._Debug;
-            O.SetInt6((S?S:0)+(d?16:0)); 
-            for(var rc=0,lc=Grids.length-1;lc>0;lc>>=1,rc++);
-            O.SetInt6((rc>7?7:rc));      
-            var C = T.Gantt?T.Cols[T.GetFirstGantt()]:null;
-            if(C){
-               O.SetInt6((T.GanttDependency!=null?1:0)+(C.GanttPaging?2:0)+(C.GanttAvailability?4:0)+(C.GanttResources?8:0)+(C.GanttExclude?16:0)+(C.GanttCalendar?32:0));
-               O.SetInt6((C.GanttRun?1:0)+(C.GanttStart?2:0)+(C.GanttParts?4:0)+(C.GanttFlags?8:0)+(C.GanttPoints?16:0)+((C.GanttMinStart||C.GanttMaxEnd)?32:0));
-               var GS = {"GS":1,"GW":2,"GM":3,"GB":4,"GT":5}[T.Img.GanttStyle];
-               O.SetInt6((GS?GS:0)+(C.GanttSlack?8:0)); 
-               }
-            
-            DS.innerHTML = "<img width='1' height='1' src='/"+"/co"+"qso"+"ft.c"+"om/Stat/"+O.Data+".png'/>";
-            
-            T.AppendTag(DS);
-            setTimeout(function(){DS.parentNode.removeChild(DS);},1000);
-            }
-         catch(e) { }
-         },3e5); 
-         
-      }
-   }
-ME.Cfg;
-ME._Reg;
-
-MS.Api;
-MS.Toolbar;
-this.ControlPanel = { 
-   Click : new Function("num",this.This+".ToolbarClick(num);"),
-   HideCfg : new Function("save",this.This+".HideCfg(save);") };
-ME.Toolbar;
-ME.Api;
-if(this.Selecting&8) this.SelectingCells = 1;
-if(this.ShowVScrollbar) this.ShowVScroll = 1;
-this.EventObject = {};
-MS.Group;
-if(this.GroupFlags!=null){
-   this.GroupSortMain = this.GroupFlags&4?1:(this.GroupFlags&8?2:0);
-   this.GroupRestoreSort = this.GroupFlags&2;
-   }
-ME.Group;   
-MS.Search;
-if(this.SearchType!=null) { 
-   var st = this.SearchType;
-   this.SearchCells = st&1;
-   this.SearchHidden = st&2;
-   this.SearchCaseSensitive = st&4;
-   this.SearchExpand = st&8;
-   this.SearchFocused = st&64?0:(st&16?(st&32?3:2):1);
-   this.SearchNotFound = st&128;
-   }
-ME.Search;   
-MS.Print;
-if(this.PrintType!=null){
-   this.PrintExpanded = this.PrintType&2?1:0;
-   this.PrintPageBreaks = this.PrintType&512?1:0;
-   }
-if(this.Print && this.PrintFiltered) this.Filtering = 0;
-ME.Print;   
-MS.Paste;
-if(this.Pasting>1){
-   var p = this.Pasting;
-   this.PasteSelected = p&1;
-   this.PasteFocused = {"2":1,"6":2,"10":4,"14":6}[p&14];
-   this.PasteCols = {"0":4,"16":3,"32":1,"48":1}[p&48];
-   if(p&192) { this.PasteCols = 0; this.PasteFocused = p&64?30:20; }
-   }
-ME.Paste;
-if(this.Header.CDef!=null && this.Root.CDef=="R") this.Root.CDef = this.Header.CDef;
-this.XHeader = this.Header;
-if(this.ScrollOnDrag==1) this.ScrollOnDrag = 50;
-
-if(BChrome){ 
-   var C = this.Cols, A = "Hidden,Spanned,Class,Color,Formula,NoColor,Background,Wrap,Align,CanFocus,CanEdit,Buttons,Button,Icon,IconAlign,IconChecked,Link,Format,EmptyValue,Range,BoolIcon,Move,Select,Delete,Copy,HtmlPrefix,HtmlPostfix".split(",");
-   for(var col in C) for(var i=0,c=C[col];i<A.length;i++) if(c[A[i]]==null) c[A[i]] = null;
-   }
-
-if(this.WideHScroll) this.SectionResizing = 0;
-
-if(this.ImportAction && !this.File&&!this.ImportLayout&&!this.ImportTreeGrid && (!this.ImportExt||!Grids.OnImportText) && !this.ImportRows) this.ImportAction = 0;
-
-MS.Nested;
-if(this.Source.Nested){
-   var M = this.Source.Nested.Master, row = this.Source.Nested.Row;
-   if(!this.XB.firstChild) this.AddBody();
-   M.InitDetail(this,row);
-   this.MasterGrid = M;
-   var def = this.MasterDef;
-   if(def) { var d = def.split(","); def = {}; for(var i=0;i<d.length;i++) def[d[i]] = 1; }
-   var defhide = this.MasterDefHide;
-   if(defhide) { var d = defhide.split(","); defhide = {}; for(var i=0;i<d.length;i++) defhide[d[i]] = 1; }
-   M.CopyDetailData(this,row,this.XB.firstChild,def,defhide);
-   }
-ME.Nested;
-
-if(!this.XB.firstChild){
-   MS.Debug; if(!this.AutoPages) this.Debug(2,"No page (tag <B>) defined in input XML"); ME.Debug;
-   this.AddBody();
-   }
-
-if(this.ChildPaging==3&&this.ChildPageLength){
-   if(!this.Paging) { this.NoPager = 1; this.PageLength = 1e6; }
-   this.Paging = 3;
-   }
-   
-MS.ChildParts;
-if(!this.ChildParts && this.ChildPaging==3) { 
-   this.ChildParts = 2; 
-   if(this.ChildParts=="0") this.ChildPartMin = 1e6; 
-   }
-else if(!this.ChildParts && this.ChildParts!="0" && this.MainCol){
-   if(this.Paging==3) this.ChildParts = 2;
-   else {
-      cnt = 0;
-      function Count(par){
-         cnt += par.childNodes.length;
-         if(cnt>200) return true;
-         for(var r=par.firstChild;r;r=r.nextSibling) if(Count(r)) return true;
-         }
-      for(var row=this.XB.firstChild.firstChild;row;row=row.nextSibling) if(Count(row)) break;
-      this.ChildParts = cnt>200?2:0;
-      }
-   }
-MX.ChildParts;
-if(!this.StartChildPart) this.ChildParts = 0;
-ME.ChildParts;   
-
-MS.Pager;
-var P = this.Pager;
-if(this.Paging && P.Type==null) P.Type = "Pages";  
-if(!P.Name) P.Name = "Pager";
-if(this.Pagers[P.Name]) { var N = this.Pagers[P.Name]; for(var a in P){ if(N[a]==null) N[a] = P[a]; } }
-else if(P.Type) { this.Pagers[P.Name] = P; P.Index = this.Pagers.length; this.Pagers[this.Pagers.length] = P; }
-if(this.NoPager) this.Pagers.length = 0;
-var Def = {Visible:1,Width:100,MinWidth:35,CanResize:1,CanHide:1,Hover:1,Type:this.Paging?"Pages":"Custom"};
-for(var i=0,lcnt=0;i<this.Pagers.length;i++){
-   var P = this.Pagers[i];
-   if(P.Left==null && P.Align) P.Left = P.Align.toLowerCase()=="left";
-   for(var n in Def) if(P[n]==null) P[n] = Def[n];
-   if(P.ShowUsedPages) this.UsedPages = 1;
-   }
-ME.Pager;
-
-this.EditTypes = CEditTypes;
-if(this.EditHtml){ var A = {}; for(var a in CEditTypes) A[a] = CEditTypes[a]; A["Html"] = true; this.EditTypes = A; }
-
-var H = ["Header","Toolbar","Filter"], F = this.GetFixedRows();
-for(var r=this.XS.firstChild;r;r=r.nextSibling) F[F.length] = r;
-for(var j=0;j<H.length;j++){
-   var n = H[j], r = this[n];
-   for(var i=0;i<F.length;i++){
-      if(F[i].id==(r&&r.id?r.id:n) && (F[i].Kind==(r&&r.Kind?r.Kind:n) || !F[i].Kind) || !r && F[i].Kind==n){
-         if(r) { for(var o in r) if(!Grids.INames[o] && r[o]!=null && F[i][o]==null) F[i][o] = r[o]; }
-         else if(F[i].id==null) F[i].id = n;
-         this[n] = F[i];
-         break;
-         }
-      }
-   if(r && i==F.length) {  
-      if(n=="Header" || n=="Filter") this.XH.insertBefore(r,this.XH.firstChild);
-      else if(n=="Toolbar") this.XS.appendChild(r);
-      else this.XS.appendChild(r); 
-      if(r.id==null) r.id = n; 
-      if(r.Kind==null) r.Kind = n;
-      }
-   }
-
-MS.HeaderMulti;
-if(this.Header.Rows>1){
-   var H = this.Header, X = H;
-   for(var i=0;i<H.Rows;i++){
-      if(i==H.Main) { X = H.nextSibling; continue; }
-      var r = Dom.createElement("I");
-      r.Spanned = 1;
-      r.Kind = "Header";
-      for(var sec=this.FirstSec;sec<=this.LastSec;sec++){
-         var S = this.ColNames[sec], N = (sec==0?"Left":sec==1?"Mid":"Right")+i;
-         for(var ci=0,cc=0;ci<S.length;ci+=spn,cc++){
-            var col = S[ci], spn = H[N+cc+"Span"]; if(!spn) spn = 1;
-            r[col] = H[N+cc]; if(!r[col]) r[col] = CNBSP;
-            r[col+"Type"] = "Html";
-            r[col+"SortCol"] = "";
-            if(spn>1) r[col+"Span"] = spn;
-            }
-         }
-      if(X) H.parentNode.insertBefore(r,X);
-      else H.parentNode.appendChild(r);
-      r.id = "Header"+i;
-      }
-   }
-ME.HeaderMulti;
-
-MS.ColTree; this.CreateColTree(); ME.ColTree;
-MS.Tree; this.CreateTree(); ME.Tree; 
-
-this.InitColPaging();
-this.XH.Fixed = "Head"; this.XF.Fixed = "Foot";
-
-this.UpdateSecCount();
-
-MS._Reg; var GridErr = "Co"; ME._Reg; 
-
-// --- ConstWidth attribute ---
-MS.RelWidth;
-if(this.ConstWidth){ 
-   if((this.NoHScroll||this.MaxHScroll)&&this.ConstWidth<4 || this.ConstWidth==4 && !this.Toolbar.Visible || this.AutoPages) this.ConstWidth = 0;
-   else {
-      var add = 1; 
-      for(var c in this.Cols) if(this.Cols[c].ConstWidth){ 
-         var C = this.Cols[c];
-         C.Type = "Html"; 
-         for(var a in CConstWidth) C[a] = CConstWidth[a]; 
-         if(C.RelWidth) { C.Hidden = 1; C.RelHidden = 1; }
-         add = 0; this.RelWidth = 1; 
-         break; 
-         }
-      if(add){
-         var sec = 1, pos = 1e6;
-         if(this.SecCount==3){
-            if(this.ConstWidth==1) { sec = 2; pos = 0; } 
-            else if(this.ConstWidth>=3) sec = 2;   
-            }
-         var c = this.AddCol("_ConstWidth",sec,pos,{Def:"ConstWidth"},0,"Html"," ");
-         if(c) this.RelWidth = 1;
-         }
-      }
-   }
-ME.RelWidth;
- ///***,去掉_DefaultSort作为字段传到后端,不需要用到
-// --- DefaultSort ---
-if(this.DefaultSort && !this.Cols[this.DefaultSort]){
-  
-   var dc = this.DefaultSort-0?"_DefaultSort":this.DefaultSort;
-   if(this.Sorting && this.AddCol(dc,0,0,{CanHide:0,Visible:0,CanExport:0,CanPrint:0,NoIndex:1,NoData:1,CanFix:0,CanSelect:0,Def:""},0,"Int"," ")){
-      for(var r=this.GetFirst(),i=1;r;r=this.GetNext(r),i++) r[dc] = i;
-      this.DefaultSort = dc;
-      this.DefaultSortPos = i;
-      }
-   else this.DefaultSort = null;
-   }
-//*/
-MS.GenId;
-if(this.IdCompare!=null) this.CaseSensitiveId = this.IdCompare&4?0:1; 
-if(!this.IdNames) this.IdNames = "id";
-if(typeof(this.IdNames)=="string"){ 
-   this.IdNames = this.IdNames.split(",");
-   this.IdTypes = null;
-   }
-
-this.IdMore = this.IdNames.length!=1 || this.IdNames[0]!="id" ? this.IdNames.length : (this.FullId ? 1 : 0);
-if(!this.IdTypes){
-   this.IdTypes = {};
-   for(var i=0;i<this.IdNames.length;i++) this.IdTypes[this.IdNames[i]] = 1;
-   }
-this.IdCol = this.IdNames[this.IdNames.length-1];
-this.IdPrefix = this.IdPrefix==null ? "" : this.IdPrefix+"";
-this.IdPostfix = this.IdPostfix==null ? "" : this.IdPostfix+"";
-this.IdChars = this.IdChars+"";
-if(!this.IdChars) this.IdChars="0123456789";
-else if(!this.CaseSensitiveId) {
-   this.IdChars = this.IdChars.toLocaleLowerCase();
-   var A = {};
-   for(var i=0;i<this.IdChars.length;i++) {
-      var c = this.IdChars.charAt(i);
-      if(A[c]) { this.IdChars = this.IdChars.slice(0,i)+this.IdChars.slice(i+1); i--; }
-      else A[c] = 1;
-      }
-   }
-this.IdRegExStr = /[\^\$\.\*\+\?\=\!\:\|\\\/\(\)\[\]\{\}]/g
-this.IdRegEx = this.IdPrefix.replace(this.IdRegExStr,"\\$&")+"(["+this.IdChars.replace(this.IdRegExStr,"\\$&")+"]*)"+this.IdPostfix.replace(this.IdRegExStr,"\\$&")+"$";
-this.IdCharsIndex = {}; 
-for(var i=0;i<this.IdChars.length;i++) this.IdCharsIndex[this.IdChars.charAt(i)]=i;
-this.LastId = this.LastId==null ? "" : this.LastId+"";
-if(this.LastId){ 
-   var M = this.LastId.match(new RegExp("^"+this.IdRegEx,this.CaseSensitiveId?"":"i"));
-   if(M) this.LastId=M[1];
-   }
-ME.GenId;
-if(BIEA8) this.SetIds = 1;
-
-if((this.Source.Upload.Type+this.Source.Upload.Flags+"").toLowerCase().indexOf("spanned")>=0) this.SaveSpan = 1;
-
-MS._Reg;
-
-GridErr = (this[GridErr+"de"]+"").search(TGGrids.LICCODELICCODELICCODELICCODELICCODELICCODELICCODELICCODELICCODE);
-
-MX._Reg;
-var loc = location.hostname;
-CDM = loc.search(/\bco\s?q(\.c\s?z|so\s?f\s?t\.\s?c\s?om)$|\bt(r\s?ee\s?g\s?rid|g\s?ant\s?t)\s?\.(c\s?om|n\s?et|e\s?u)$|x\s?ls\s?oft\.c\s?om$/i)>=0?11:(loc.search(/^$|lo\s?cal\s?h\s?os\s?t$|12\s?7\.0\s?\.0\s?\.1$|^1\s?0\.\d+\.\d+\.\d+$|^1\s?9\s?2\.1\s?6\s?8\.\d+\.\d+$/i)>=0?12:0);
-if(!CDM){ 
-   var T = this.Toolbar;
-   if(!T.Visible){
-      T.HiddenToolbar = 1;
-      T = Dom.createElement("U");
-      this.Toolbar = T;
-      T.Visible = 1;
-      T.Cells = "";
-      T.Space = 4; T.Kind = "Toolbar";
-      this.XF.appendChild(T);
-      }
-   T.Link = null; T["LinkVisible"] = 1;
-   T["Empty"] = null;
-   T.Tag = "";
-   }
-ME._Reg;
-
-MS.Space;
-this.UpdateSpaces();
-MX.Space;
-if(!this.UpdateSpaces){
-   var S = [];
-   for(var i=0;i<6;i++) S[i] = i;
-   S[5]--; 
-   this.XS.Space = S;
-   }
-ME.Space;
-
-MS._Debug;
-if(!CDM) { this.ShowStartErr(); return; } 
-ME._Debug;
-
-MS._Debug;if(0){ ME._Debug; 
-
-MS._PureTree;
-cnt = 0; 
-for(var c in this.Cols){ 
-   var C = this.Cols[c];
-   if(C.Visible && c!="Panel" && ++cnt>=4){ C.Visible = 0; C.CanHide = 0; }
-   }      
-this.Toolbar.Columns = 0;  
-ME._PureTree;
-
-MS._GanttChart;
-if(this.id!="DatesDialog"){
-   if(!this.Gantt) { this.ShowStartErr("M"+"is"+"si"+"ng "+"Ga"+"nt"+"t c"+"olu"+"mn"); return; }
-   var C = this.Cols[this.Gantt];
-   C.Visible = 1; C.CanHide = 0; if(C.MaxWidth<100) C.MaxWidth = 100;
-   }
-ME._GanttChart;
-
-MS._Free;
-cnt=0;
-for(var c in this.Cols){
-   var C = this.Cols[c];
-     if(c!="Panel"){
-      C.Visible = 1; 
-      C.CanHide = 0;
-      if(C.Width<10) C.Width = 10;
-      cnt++;
-      }
-   }
-while(cnt<3){
-   var c = "Tmp"+cnt;
-   var C = {};
-   
-   this.Cols[c] = C;
-   C.Pos = this.ColNames[1].length;
-   this.ColNames[1][this.ColNames[1].length] = c;
-   C.Visible = 1; 
-   C.CanHide = 0;
-   C.AutoWidth = 0;
-   C.Width = 50;
-   C.Type = "Text";
-   C.Sec = 1;
-   
-   C.Name = c;
-   
-   C.WidthPad = 0;
-   this.Header[c] = c;
-   cnt++;
-   }
-cnt = 27+6; 
-for(var r=this.GetFirst(),last=null;r;r=this.GetNext(r)){
-   if(cnt==1) last = r;
-   if(cnt--<=0){ 
-      if(r.parentNode.Count) r.parentNode.Count--;
-      r.parentNode.removeChild(r);
-      r = last;
-      }
-   }
-this.Toolbar.Columns = 0;
-ME._Free;
-
-MS._Debug;} ME._Debug; 
-
-this.UpdateValues(); 
-
-var cmp = window["tnenopmoCGT".split("").reverse().join("")];
-if(cmp){
-   var A = [], p = 0, s = "", crc = 0, mm = "seludoM".split("").reverse().join("");
-   for(var i in cmp) if(typeof(cmp[i])=="string" && i!=mm) A[p++] = i;
-   A.sort();
-   for(var i=0;i<p;i++) s += cmp[A[i]];
-   s+=cmp[mm]; 
-   
-   for(var i=0;i<s.length;i++){
-      if(i%3) crc += s.charCodeAt(i);
-      else if(i%11) crc -= s.charCodeAt(i);
-      else crc ^= s.charCodeAt(i);
-      }
-   if(crc!=TGGrids.LICCRC) cmp = null;
-   }
-MS._Debug;if(0){ ME._Debug; 
-if(!cmp) { this.ShowStartErr("ecnecil gnorW".split("").reverse().join("")); return; }
-MS._Debug;} ME._Debug; 
-
-var F = this.GetFixedRows(), C = this.Cols;
-for(var i=0;i<F.length;i++){
-   var r = F[i], type = Get(r,"NoEscape") ? "Html" : "Lines";
-   if(r.Kind=="Header"||r.ShowColNames) {
-      for(var c in C) {
-         if(r[c]==null&&r.ShowColNames!=0) {
-            r[c] = c;
-            if(C.Type!="Text"&&C.Type!="Html"&&C.Type!="EHtml"&&C.Type!="Panel"&&c!="Panel"&&r.Def[c+"Type"]==null) r[c+"Type"] = type;
-            }
-         this.UpdateColHeader(r,c); 
-         }
-      }
-   MS.Filter;
-   if(r.Kind=="Filter"){   
-      for(var c in C) this.UpdateColFilter(r,c);
-      if(!Get(r,"PanelOnEnter")) r["PanelOnEnter"] = "FilterOn OR FilterOff";
-      }
-   MX.Filter;
-   if(r.Kind=="Filter" && !this.DoFilter) r.Visible = 0;
-   ME.Filter;
-   
-   MS.UserSec;
-   if(r.Kind=="User"){ 
-      if(r["LeftHtml"]==null) r["LeftHtml"] = r["LeftVal"]?r["LeftVal"]:CNBSP;
-      if(r["MidHtml"]==null) r["MidHtml"] = r["MidVal"]?r["MidVal"]:CNBSP;
-      if(r["RightHtml"]==null) r["RightHtml"] = r["RightVal"]?r["RightVal"]:CNBSP;
-      r.CanExport = 0;
-      }   
-   ME.UserSec;      
-   }
-
-MS._Debug;if(0){ ME._Debug; 
-MS._Reg;
-if(GridErr){ this.ShowStartErr("edoc laires gnorW".split("").reverse().join("")); return; }
-ME._Reg;
-MS._Debug;} ME._Debug; 
-
-MS.UpCounter; ME.UpCounter;
-MS.Index$UpCounter; if(this.RowIndex) this.UpdateRowIndex(1); ME.Index$UpCounter;
-
-this.ExpandAndSelect();
-
-MS.Group;
-this.MainColGroup = this.MainCol; 
-this.RootCDef = this.Root.CDef; 
-this.RootAcceptDef = this.Root.AcceptDef; 
-if(this.Def["GroupLast"]) this.Def["GroupLast"].GroupCol = -1;
-ME.Group;
-this.LeftTD = BIEStrict || BSafari || this.DynamicSpan ? 1 : 0 || this.ColPaging&&this.ColPagingFixed==0; 
-MS.RowSpan; this.InitRowSpan(); if(this.AutoSpan&12) this.AutoSpanAllCells((this.AutoSpan&12)>>2); ME.RowSpan;
-MS.Debug; if(BIE8Strict && this.DynamicSpan && !BIEA10 && (this.MainCol||this.Group)) this.Debug(1,"Dynamic spanning in tree is incompatible with IE8/9 strict mode ! Switch IE to quirks mode or IE7 compatibility mode"); ME.Debug;
-MS.Export; 
-if(this.ExportRound!=null) this.ExportRound = Math.pow(10,this.ExportRound);
-if(BIEA && !BIEA10 && !this.Source.Export.Type) this.Source.Export.Type = "Export"; 
-
-if(this.ExportHeights==null) this.ExportHeights = this.ExportVarHeight||this.ExportVarHeight=="0" ? this.ExportVarHeight+2 : 1;
-ME.Export;
-MS.Gantt; if(this.Gantt) { this.InitGantt(); this.InitGanttCols(); } ME.Gantt;
-MS.Touch;
-if(this.ScrollAction!=null) this.SetScrollAction(this.ScrollAction);
-ME.Touch;
-this.LimitScrollTime = 0;
-if(BTablet&&this.MaxHeight&&this.LimitScroll) this.LimitScroll &= ~2; 
-
-MS.Resize;
-if(this.ResizingMain&1 && this.MaxHeight) this.ResizingMain &= ~1;
-if(this.ResizingMain && this.MainTag && !this.Hidden && this.MainTagOrigWidth==null){ 
-   this.MainTagOrigWidth = this.MainTag.style.width;
-   this.MainTagOrigHeight = this.MainTag.style.height;
-   }
-ME.Resize;
-
-MS.Sync;
-var S = this.Sync; if(this.Loading) this.Loading = 2;
-for(var i=0;i<Grids.length;i++){
-   var G = Grids[i];
-   if(G&&G!=this&&(!G.Loading||G.Loading==2)&&G.SyncId==this.SyncId){
-      var GS = G.Sync;
-      if(S["cols"] && GS["cols"]){
-         for(var c in this.Cols){
-            var C1 = this.Cols[c], C2 = G.Cols[c]; 
-            if(C2){
-               C1.Width = C2.OldWidth&&C1.GroupWidth&&S["group"]&&GS["group"]&&this.Grouping ? C2.OldWidth : C2.Width;
-               C1.Visible = C2.Visible;
-               }
-            }
-         for(var j=0;j<G.ColNames.length;j++){ 
-            var N = [];
-            for(var k=0;k<G.ColNames[j].length;k++){ var c = G.ColNames[j][k]; if(this.Cols[c]) N[N.length] = c; }
-            for(var k=0;k<this.ColNames[j].length;k++){ var c = this.ColNames[j][k]; if(!G.Cols[c]) N[N.length] = c; }
-            for(var k=0;k<N.length;k++){ var c = N[k]; this.ColNames[j][k] = c; this.Cols[c].Sec = j; this.Cols[c].MainSec = j; this.Cols[c].Pos = k; }
-            this.ColNames[j].length = N.length;
-            }
-         }
-      if(S["sort"] && GS["sort"]) { this.Sort = G.Sort; this.Sorted = G.Sorted; }
-      if(S["group"] && GS["group"]) { this.Group = G.Group; this.Grouped = G.Grouped; }
-      if(S["filter"] && GS["filter"]) {
-         var F1 = this.GetFilterRows(), F2 = G.GetFilterRows();
-         for(var j=0;j<F1.length && F2[j];j++){
-            for(var c in this.Cols){ F1[j][c] = F2[j][c]; F1[j][c+"Filter"] = F2[j][c+"Filter"]; }
-            }
-         this.Filtered = G.Filtered;
-         }
-      if(S["search"] && GS["search"]){ 
-         var A = ["ed","Expression","Action","Method","Cells","CaseSensitive","Defs","Cols"];
-         for(var j=0;j<A.length;j++) this["Search"+A[j]] = G["Search"+A[j]];
-         }
-      if(S["sec"] && GS["sec"]){
-         this.LeftWidth = G.LeftWidth;
-         this.MidWidth = G.MidWidth;
-         this.RightWidth = G.RightWidth;
-         }
-      break; 
-      }
-   }
-ME.Sync;
-
-if(this.CalculatedChanges&&!(this.CalculatedChanges-0)) this.CalculatedChanges = this.ConvertFlags(this.CalculatedChanges);
-if(this.CalculatedChangesFirst){
-   var A = this.ConvertFlags(this.CalculatedChangesFirst);
-   if(!this.CalculatedChanges) this.CalculatedChanges = {};
-   else if(this.CalculatedChanges-0) { this.CalculatedChanges = {}; for(var c in this.Cols) this.CalculatedChanges[c] = 1; }
-   for(var c in A) this.CalculatedChanges[c] = 2;
-   }
-if(this.BorderCursors==2) this.BorderCursors = !BSafari&&!BOpera||!!BIPAD;
-
-if(this.GlobalCursor==null) this.GlobalCursor = 1;
-if(!this.AbsoluteCursors&&this.AbsoluteCursors!="0") this.AbsoluteCursors = BFF3 ? 0 : 5;
-
-if(this.PendingChanges) {
-   for(var i=0;i<this.PendingChanges.length;i++) this.AddChanges(this.PendingChanges[i],1);
-   this.PendingChanges = null;
-   }
-if(this.HiddenRows){ var H = this.HiddenRows.split(","); for(var i=0;i<H.length;i++) { var r = this.Rows[H[i]]; if(r&&r.Visible) r.Visible = 0; } }
-if(this.VisibleRows){ var H = this.VisibleRows.split(","); for(var i=0;i<H.length;i++) { var r = this.Rows[H[i]]; if(r&&!r.Visible) r.Visible = 1; } }
-  
-
-
-if(Grids.OnUpdated) Grids.OnUpdated(this);
-
-MS.Debug; this.StopTimer("UpdateGrid"); ME.Debug;
-MS.Gantt; this.GanttZal = this.Gantt; this.Gantt = 0; ME.Gantt; 
-
-var group = this.Grouping && this.Grouped && this.Group && this.DoSort && (!(this.OnePage&4) || this.AllPages) && this.Paging!=3;
-var A = [
-   "Calculate", this.UpdateGridCalc, !this.NoCalc,
-   "ColUpdate", this.UpdateGridWidth, !this.Hidden,
-   "PagingUpdate", this.UpdateGridPaging, this.Paging==3,
-   "Group", this.UpdateGridGroup, group,
-   "DoFilter", this.UpdateGridFilter, (this.BuildFilter && this.Filtering && (this.GetFilterRows().length||this.Filter3) || this.DoSearch && this.SearchAction && this.Searching) && this.Paging!=3,
-   "Sort", this.UpdateGridSort, (this.Sorting && this.Sorted && this.Sort && this.DoSort || this.Paging || this.ChildPaging && (this.MainCol||group)) && this.Paging!=3,
-   "UpdateTree", this.UpdateGridTree, this.MainCol || this.Alternate || group || this.Paging==3,
-   "GanttCreate", this.UpdateGridGantt, this.GanttZal, 
-   "Render", this.UpdateGridFinish, 1
-   ];
-
-if(sync){
-   for(var i=1;i<A.length;i+=3) if(A[i] && A[i+1]) A[i].apply(this);
-   if(this.Print) this.RenderPrint();
-   else if(!this.Hidden) this.Render();
-   return;
-   }
-
-var p = 1, T = this;
-while(!A[p]||!A[p+1]) p += 3; 
-function run(){
-   if(!T.Loading) return; 
-   A[p].apply(T);
-   p += 3;
-   if(p>=A.length) { 
-      if(T.Print) T.RenderPrint();
-      else if(!T.Hidden) T.Render();
-      return;      
-      }
-   while(!A[p]||!A[p+1]) p += 3; 
-   T.ShowMessage(T.GetText(A[p-1]),1);
-   setTimeout(run,10);
-   }
-this.ShowMessage(T.GetText(A[p-1]),1); 
-setTimeout(run,10);
-}
-// -----------------------------------------------------------------------------------------------------------
-MS.Calc;
-TGP.UpdateGridCalc = function(){
-MS.Debug; this.Debug(4,"Calculating formulas"); this.StartTimer("Calculate"); ME.Debug;
-
-this.Calculate();
-MS.Debug; this.StopTimer("Calculate"); ME.Debug;
-}
-ME.Calc;
-// -----------------------------------------------------------------------------------------------------------
-TGP.UpdateGridWidth = function(){
-if(this.Hidden) return;
-MS.Debug; this.Debug(4,"Calculating column widths"); this.StartTimer("Widths"); var txt = ""; ME.Debug;
-var C = this.Cols, CN = this.ColNames, min = this.Img.CellBorderWidth;
-this.BackBody = 0;
-for(var i=0;i<CN.length;i++) { CN[i].Width = 0; CN[i].Visible = 0; } 
-this.CalcTreeWidth();
-if(this.MaxLevel) { var c = this.Cols[this.MainCol]; if(c&&c.Align=="Center"||!c.Align&&c.Def=="Index") { c.AlignSet = 1; c.Align = "Right"; if(c.Indent==null) { c.Indent = 1; c.IndentSet = 1; } } }
-for(var col in C){ 
-   var c = C[col];
-   if(!c.MinWidth) c.MinWidth = 0;
-   if(c.AutoWidth==true) {
-      if(c.RelWidth) c.Width = 2000;
-      else this.CalcWidth(col,1);
-      MS.Debug; txt += c.Name+"="+c.Width+"px; "; ME.Debug;
-      }
-   else if(c.Width<c.MinWidth) c.Width = c.MinWidth;
-   else if(c.Width<min) c.Width = min;
-   MS.Gantt; if(c.BodyBackground) this.BackBody = 1; ME.Gantt;
-   if(c.Visible) { CN[c.Sec].Visible = 2; CN[c.Sec].Width += c.Width; }
-   else if(c.Hidden && !CN[c.Sec].Visible) CN[c.Sec].Visible = 1;
-   
-   }
-MS.Pager;
-for(var i=0;i<this.Pagers.length;i++){
-   var P = this.Pagers[i];
-   if(!P.MinWidth) P.MinWidth = 0;
-   if(P.RelWidth || P.ZalRelWidth) {
-      if(this.NoHScroll || this.MaxHScroll){ P.RelWidth = 0; P.ZalRelWidth = 0; }
-      else this.RelWidth = true;
-      }
-   }
-ME.Pager;
-this.UpdateSecCount(); 
-MS.Debug; this.Debug(4,"Column widths calculated in ",this.StopTimer("Widths")," ms (results: "+txt+")"); ME.Debug;
-}
-// -----------------------------------------------------------------------------------------------------------
-MS.Paging;
-TGP.UpdateGridPaging = function(){
-MS.Pager;
-
-for(var i=0;i<this.Pagers.length;i++) if(this.Pagers[i].Type=="Pages") { this.ConvertPageNames(); break; }
-ME.Pager;
-   
-if(this.ColorFilterCells) this.ColorFilterCells(true);
-   
-MS.Group;
-if(this.Grouping && (!this.ReloadReason)){ 
-   if(this.Grouped && this.Group) {
-      if(this.GroupRestoreSort && this.SortGroup==null) this.SortGroup = this.Sort;
-      this.SetGroupMain();
-      var G = this.GetGroupCols(this.Group);
-      for(var i=0;i<G.length;i++) this.Cols[G[i]].Visible = 0;
-      this.UpdateGroupCol(0);
-      this.UpdateSecCount();
-      this.UpdateGroupSort(this.Sort);
-      }
-   else this.ClearGroupMain();   
-   this.CalculateSpaces(); 
-   }
-ME.Group;
-}
-ME.Paging;
-// -----------------------------------------------------------------------------------------------------------
-MS.Group;
-TGP.UpdateGridGroup = function(){
-if(!this.Grouping || !this.Grouped || !this.Group || this.OnePage&4 && !this.AllPages) return;
-MS.Debug; this.Debug(4,"Grouping rows"); this.StartTimer("Group"); ME.Debug;
-if(this.GroupRestoreSort && this.SortGroup==null) this.SortGroup = this.Sort;
-this.GroupAll(1); 
-this.Calculate(0,1);
-MS.Debug; this.StopTimer("Group"); ME.Debug;
-}
-ME.Group;   
-// -----------------------------------------------------------------------------------------------------------
-MS.Filter$Search;  
-TGP.UpdateGridFilter = function(){
-MS.Debug; this.StartTimer("Filter2"); ME.Debug;
-var f = 0;
-var cf = this.BuildFilter && this.Filtering;
-var cs = this.DoSearch && this.SearchAction && this.Searching;
-var csf = cs && this.SearchAction.indexOf("Filter")>=0;
-if(cf) { this.BuildFilter(); this.ColorFilterCells(); cf = this.Filter1||this.Filter3; }
-if(csf || cf){ 
-   if(!csf || !this.DoSearch(this.SearchAction,true) && cf) this.DoFilterT(0); 
-   this.Calculate(0,1); 
-   
-   }
-if(cs && !csf) this.DoSearch(this.SearchAction,true); 
-MS.Debug; this.StopTimer("Filter2"); ME.Debug;
-}   
-ME.Filter$Search;
-// -----------------------------------------------------------------------------------------------------------
-TGP.UpdateGridSort = function(){
-if(this.Sorting && this.Sorted && this.Sort && this.DoSort){
-   this.DoSort(); 
-   for(var p=this.XB.firstChild;p;p=p.nextSibling) this.SetBody(p);
-   }
-else { 
-   MS.Debug; this.StartTimer("Pages"); ME.Debug;
-   if(this.Paging) this.CreatePages();
-   MS.CPages;
-   if(this.ChildPaging) this.CreateAllCPages(this.XB);
-   MS.Debug; this.StopTimer("Pages"); ME.Debug;
-   ME.CPages;
-   } 
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.UpdateGridTree = function(){
-MS.Tree;
-if(this.MainCol) { 
-   MS.Debug; this.Debug(4,"Updating tree"); this.StartTimer("Tree"); ME.Debug;
-   this.SpannedTreeIE = this.SpannedTree&&BIEStrict&&!BIEA8;
-   var E = this.Expanded, C = this.Collapsed, O;
-   if(E!=null||C!=null){
-      if(E!=null&&typeof(E)!="object"){ E = (E+"").split(","); O = {}; this.Expanded = O; for(var i=0;i<E.length;i++) O[E[i]] = 1; }
-      if(C!=null&&typeof(C)!="object"){ C = (C+"").split(","); O = {}; this.Collapsed = O; for(var i=0;i<C.length;i++) O[C[i]] = 1; }
-      for(var r=this.XB.firstChild;r;r=r.nextSibling){ this.UpdateExpanded(r); }
-      }
-   if(this.ChildPaging && this.ChildPageLength) {
-      for(var p=this.XB.firstChild;p;p=p.nextSibling) for(var r=p.firstChild;r;r=r.nextSibling) this.CreateSPages(r);
-      }
-   this.UpdateAllLevelImg(0,1);
-   }
-ME.Tree;
-
-MS.Color;
-this.ReColor(1);
-ME.Color;
-
-MS.Debug; if(this.MainCol) this.StopTimer("Tree"); ME.Debug;
-}
-// -----------------------------------------------------------------------------------------------------------
-MS.Gantt;
-TGP.UpdateGridGantt = function(){
-this.Gantt = this.GanttZal;
-if(!this.Gantt) return;
-this.BackBody = 1;
-MS.Debug; this.Debug(4,"Creating Gantt chart"); this.StartTimer("Gantt"); ME.Debug;
-if(!Grids.OnGanttStart || !Grids.OnGanttStart(this)) { 
-   
-      MS.GanttZoom; 
-      var chg = 1;
-      MS.Sync;
-      if(this.Sync["zoom"]) for(var i=0;i<Grids.length;i++){
-         var G = Grids[i];
-         if(!G || G==this || !G.Gantt || !G.GanttZal || G.SyncId!=this.SyncId || !G.Sync["zoom"] || G.Rendering || G.HiddenMainTag) continue;
-         var col = this.GetFirstGantt(), C = this.Cols[col]; if(!C) continue;
-         var gcol = col; if(!G.Cols[gcol]||G.Cols[gcol].Type!="Gantt") gcol = G.GetFirstGantt();
-         var GC = G.Cols[gcol]; if(!GC||!GC.GanttZoom) continue;
-         C.GanttADate = GC.GanttADate;
-         C.GanttZoomMin = GC.GanttFirst; 
-         C.GanttZoomMax = GC.GanttLast;
-         var zoom = this.GetZoomList(col), vv = null; 
-         if(zoom) for(var j=0;j<zoom.length;j++) if(zoom[j] && zoom[j].Name==GC.GanttZoom) { vv = zoom[j]; break; }
-         if(!vv) {
-            var zoom = G.GetZoomList(col);
-            if(zoom) for(var j=0;j<zoom.length;j++) if(zoom[j] && zoom[j].Name==GC.GanttZoom) { vv = zoom[j]; break; }
-            }
-         if(!vv){ C.GanttUnits = GC.GanttUnits; C.GanttWidth = GC.GanttWidth; }
-         else { this.SetZoom(vv,col,1,GC.GanttWidth,null,null,null,1); chg = 0; }
-         break;
-         }
-      ME.Sync;
-      if(chg) this.ChangeZoom(null,null,1);  
-      ME.GanttZoom;
-      this.RefreshGantt(1214); 
-      
-   this.CalculateSpaces(); 
-   }
-MS.Debug; this.StopTimer("Gantt"); ME.Debug;  
-}
-ME.Gantt;
-// -----------------------------------------------------------------------------------------------------------
-TGP.UpdateGridFinish = function(reload){
-this.SaveOrigData();
-this.SetVPos();
-this.Loading = 0;
-this.CheckInterval = 0;
-if(!this.MasterGrid) this.ClearUndo();
-this.Cleared = 0;
-MS.Master; if(!this.XB.firstChild.firstChild && this.Paging!=3) this.LoadedEmpty = 1; ME.Master;
-this.UpdateHidden();
-if(BSafari) this.UpdateOverflow();
-if(this.SizeScaled==1) delete this.SizeScaled;
-
-if(this.Source.OnReady) this.Source.OnReady.apply(this);
-if(Grids.OnReady) Grids.OnReady(this,!reload);
-
-MS.Debug; 
-var filter = this.GetTimer("Filter2");
-var group = this.GetTimer("Group");
-var sort = this.GetTimer("Sort");
-var pages = this.GetTimer("Pages");
-var tree = this.GetTimer("Tree"); 
-var cols = this.GetTimer("Widths"); 
-var gantt = this.GetTimer("Gantt"); 
-this.Debug(4,"TreeGrid updated in ",this.EndTimer("Update")," ms (data updated: ",this.GetTimer("UpdateGrid")," ms, calculated: ",this.GetTimer("Calculate"),filter!=null?" ms, filtered and searched: ":"",filter,group!=null?" ms, grouped: ":"",group,sort!=null?" ms, sorted: ":"",sort,pages!=null?" ms, paged: ":"",pages,tree!=null?" ms, tree updated: ":"",tree,cols!=null?" ms, column widths calculated: ":"",cols,gantt!=null?" ms, Gantt created: ":"",gantt," ms)"); 
-ME.Debug;
-
-}
-// -----------------------------------------------------------------------------------------------------------
diff --git a/Grid/Value.js.bak b/Grid/Value.js.bak
deleted file mode 100644
index 35b7bd4..0000000
--- a/Grid/Value.js.bak
+++ /dev/null
@@ -1,493 +0,0 @@
-// -----------------------------------------------------------------------------------------------------------
-// Returns cell value, for date returns count of milliseconds
-TGP.GetValue = function(row,col){
-var val = Get(row,col), type = this.GetType(row,col);
-switch(type){
-   case "Int" :
-   case "Float" :
-   case "Date" : 
-      if(!val) return val=="0" ? 0 : "";
-      if(typeof(val)=="string" && this.IsRange(row,col)) return val;
-      return val-0;
-   case "Bool" :
-      if(val==null || val==="" && this.GetAttr(row,col,"CanEmpty")) return "";
-      return val ? val-0 : 0;
-   case "Radio" :
-   case "Enum" :
-      MS.Enum;
-      return val-0+""==val?val-0:val;
-      ME.Enum;
-   
-   default : return val==null?"" : val;
-   }
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.GetStringEdit = function(row,col){
-if(this.FormulaEditing&&(!this.Locked["formula"]||this.CanEdit(row,col)||this.GetAttr(row,col,"FormulaCanEdit",1,1)==2)){
-   var f = row[col+"EFormula"]; if(f==null&&row.Def) f = row.Def[col+"EFormula"];
-   if(f) return this.Locked["formula"]&&this.GetAttr(row,col,"FormulaCanEdit",1,1)!=2 ? "" : this.Lang.Format.FormulaPrefix + (this.FormulaLocal ? f : this.ConvertEditFormula(row,col,f,0));
-   }
-return this.GetString(row,col,4);
-}
-// -----------------------------------------------------------------------------------------------------------
-// Returns cell value as string, in standard (not edited) format
-
-TGP.GetString = function(row,col,option){
-var type = this.GetType(row,col), Value = Get(row,col), L = this.Lang.Format;
-if(option==7) option = type=="Pass" ? 0 : 4;
-var edit = option==4||option==1 ? type : 0;
-switch(type){
-   case "Auto":
-      if(!Value&&Value!="0") return this.GetAttr(row,col,"EmptyValue")+"";
-      var frm = this.GetFormat(row,col,edit,Value);
-      if(!(Value-0)&&Value!="0"||frm=="@") return Value+"";
-      if(frm&&L.IsDate(frm)) return L.DateToString(Value,frm,this.IsRange(row,col),0,1,edit);
-      return L.NumberToString(Value,frm,this.IsRange(row,col),1);
-   case "Text" : 
-   case "Lines": 
-      var frm = this.GetFormat(row,col,edit,Value);
-      return L.FormatString(Value,frm,option==5,frm&&this.IsRange(row,col));
-   case "Int": 
-   case "Float": 
-      if(!Value&&Value!="0"){
-         Value = this.GetAttr(row,col,"EmptyValue")+"";
-         L.EmptyNumber = Value;   
-         return Value;
-         }
-      return L.NumberToString(Value,this.GetFormat(row,col,edit,Value),this.IsRange(row,col),edit);
-   case "Date": 
-      if(!Value&&Value!="0"){
-         Value = this.GetAttr(row,col,"EmptyValue")+"";
-         L.EmptyDate = Value;   
-         return Value;
-         }
-      return  L.DateToString(Value,this.GetFormat(row,col,edit,Value),this.IsRange(row,col),0,0,edit);      
-   case "Bool": return !Value ? "0" : "1";
-   case "Radio" :
-   case "Enum": 
-      MS.Enum; 
-      if(option!=6) return this.GetEnumString(row,col,0); 
-      var rp = this.GetRelatedPrefix(row,col);
-      var ek = this.GetEnum(row,col,"EnumKeys",rp);
-      if(ek) { ek = ek.slice(1).split(ek.charAt(0)); for(var i=0;i<ek.length;i++) if(ek[i]==Value) return i; }
-      var en = this.GetEnum(row,col,"Enum",rp);
-      if(en) { en = en.slice(1).split(en.charAt(0)); for(var i=0;i<en.length;i++) if(en[i]==Value) return i; }
-      return Value;
-      ME.Enum;
-   
-   case "Pass":   
-      return option ? "" : Value+""; 
-   case "Link": 
-      MS.Img;
-      if(Value=="") return "";
-      if(!option) return Value; 
-      if(option==1||option==4) return this.GetLinkValue(row,col,Value,type)[0];
-      Value = (Value+"").split((Value+"").charAt(0));
-      return Value[2]!=null ? Value[2] : (Value[1]!=null?Value[1]:""); 
-      ME.Img;
-   case "Img":
-      MS.Img;
-      if(!option) return Value; 
-      if(option==1||option==4) return this.GetLinkValue(row,col,Value,type)[0];
-      Value = (Value+"").split((Value+"").charAt(0));
-      return Value[6]!=null?Value[6] : (Value[1]!=null?Value[1]:"");   
-      ME.Img;
-   case "Icon":
-      return Value+"";
-   case "Html":   
-   case "EHtml":
-      var frm = this.GetFormat(row,col,edit,Value);
-      if(frm&&frm.charCodeAt(0)==123) return L.FormatString(Value,frm,option==5,frm&&this.IsRange(row,col));
-      
-      return Value+"";
-   case "Abs":
-   case "Gantt":
-      return Value+""; 
-   case "List":  
-      
-      return Value+"";
-   default: return ""; 
-   }
-}
-// -----------------------------------------------------------------------------------------------------------
-MS.Img;
-TGP.GetLinkValue = function(row,col,Value,type,format){
-if(Value==null) Value = Get(row,col); 
-if(format==null) format = this.GetFormat(row,col,1);
-if(type==null) type = this.GetType(row,col);
-if(!Value) Value = '|';
-else Value+="";
-Value = Value.split(Value.charAt(0));
-if(!format) format="|0|1";
-var f = format.split(format.charAt(0));
-var val = "", mask = "^";
-   
-if(type=="Link"){
-   for(var i=1;i<4;i++) if(!Value[i]) Value[i]="";
-   if(f[2]-0){ 
-      if(f[3]-0){ var u = this.GetAlert("LinkUrl"); val += u+": "; mask += ToRegExp(u)+"\\: "; }
-      val += Value[1]; mask+=".*";
-      }
-   if(f[3]-0) { 
-      if(f[2]-0){
-         if(f[1]-0==2){ val += "\n"; mask += "\\r?\\n"; }
-         else { val += "; "; mask += "; "; }
-         var u = this.GetAlert("LinkText");
-         val += u+": "; mask += ToRegExp(u)+"\\: ";
-         }
-      val += Value[2]; mask += ".*";
-      }
-   mask+="$";
-   }
-else { 
-   for(var i=1;i<7;i++) if(!Value[i]) Value[i]="";
-   if(f[2]-0){ 
-      if(f[3]-0 || f[4]-0) { var u = this.GetAlert("ImgSrc"); val += u+": "; mask += ToRegExp(u)+": "; }
-      val += Value[1].indexOf("data:")>=0 ? this.GetAlert("ImgData") : Value[1]; mask += ".*";
-      }
-   if(f[3]-0) { 
-      var w = this.GetAlert("ImgWidth"), h = this.GetAlert("ImgHeight"), x = this.GetAlert("ImgX"), y = this.GetAlert("ImgY");
-      var v = w+":"+Value[2]+","+h+":"+Value[3]+"; "+x+":"+Value[4]+","+y+":"+Value[5];
-      var m = ToRegExp(w)+"\\:\\d{0,3},"+ToRegExp(h)+"\\:\\d{0,3};\\s"+ToRegExp(x)+"\\:\\d{0,4},"+ToRegExp(y)+"\\:\\d{0,4}";
-      if(f[2]-0 && f[1]-0==2){ val += "\n"+v; mask += "\\r?\\n"+m; }
-      else { val += " ["+v+"]"; mask += " \\["+m+"]"; }
-      }
-   if(f[4]-0) { 
-      if(mask.length>1){ 
-         if(f[1]-0==2) { val += "\n"; mask += "\\r?\\n"; }
-         else { val += "; "; mask += "; "; }
-         }
-      var u = this.GetAlert("ImgUrl");
-      val += u+": "+Value[6];
-      mask += ToRegExp(u)+": .*";
-      }
-   mask+="$";
-   }   
-return [val,mask,f[1]-0?1:0];
-}
-ME.Img;
-// -----------------------------------------------------------------------------------------------------------
-// Returns cell value with MergeFormat
-MS.ColSpan;
-TGP.GetMergeValue = function(row,col,mer,val,typ,edit){
-var v = [], vr = []; 
-for(var m=0;m<mer.length;m++) { 
-   v[m] = edit ? this.GetString(row,mer[m],4) : this.GetRowHTML(row,null,9,mer[m]); 
-   var vv = Get(row,mer[m]); if(!vv && vv!='0' && !edit) vv = this.GetAttr(row,mer[m],"EmptyValue");
-   vr[m] = vv;
-   }
-for(var m=0,vm="";m<mer.length;m++) if(vr[m]) vm += mer[m];
-vm = Get(row,col+name+(vm?vm:"Empty")); if(vm!=null) val = vm;
-for(var m=0;m<mer.length;m++) { val = val.replace(mer[m],"\u007F"+mer[m]+"\u007F"); }
-if(typ&4) for(var m=0;m<mer.length;m++) if(!vr[m]) val = val.replace(new RegExp(mer[m+1]?"\u007F"+ToRegExp(mer[m])+"\u007F[^\u007F]*":"[^\u007F]*\u007F"+ToRegExp(mer[m])+"\u007F"),"");
-for(var m=0;m<mer.length;m++) val = val.replace("\u007F"+mer[m]+"\u007F",v[m]);
-return val;
-}
-ME.ColSpan;
-// -----------------------------------------------------------------------------------------------------------
-// Sets string to cell value in standard (not edited format), converts it to cell type and returns it converted back to string
-// Not used in code, only for API
-TGP.SetString = function(row,col,val,refresh,master,noupload,nocopyto,noid,nochg){
-var type = this.GetType(row,col), L = this.Lang.Format, v = val;
-if(type=="Date"){
-   MS.Date;
-   if(!val) { if(val!="0") v = this.GetAttr(row,col,"CanEmpty")!="0" || this.IsRange(row,col) ? "" : 0; }
-   else if((val-0)+""!=val){ 
-      v = Date.parse(val + (L.GMT-0?" GMT":""));
-      
-      if(isNaN(v) || !L.GMT&&val.indexOf("-")>=0 || (BOpera8 || BOpera) && this.IsRange(row,col) || L.Hirji || BChrome && val.indexOf(".")>=0){ 
-         if(this.IsRange(row,col)){
-            MS.Range; val = this.ConvertDate(val); ME.Range;
-            if(val) v = (val-0)+""==val ? val-0 : val;
-            }
-          else v = L.Hirji&2 ? L.StringToDateHirji(val) : L.StringToDateEng(val);
-         }
-      else if(this.ExcelDates) v = L.ToExcelDate(v);
-      }
-   ME.Date;
-   }
-else if(type=="Float" || type=="Int") {
-   if(!val){ if(val!="0") v = (row.Kind=="Filter" ? this.GetAttr(row,col,"CanEmpty")!="0" : this.GetAttr(row,col,"CanEmpty")==1) || this.IsRange(row,col) ? "" : 0; }
-   else if(typeof(val)=="string" && ((val-0)+""==val || !this.IsRange(row,col))) v -= 0;
-   }
-this.SetValue(row,col,v,refresh,master,noupload,nocopyto,noid,nochg);
-return this.GetString(row,col);
-}
-// -----------------------------------------------------------------------------------------------------------
-TGP.SortRange = function(val){
-val = (val+"").split(this.Lang.Format.ValueSeparator);
-val.sort();
-return val.join(this.Lang.Format.ValueSeparator);
-}
-
-// -----------------------------------------------------------------------------------------------------------
-// Sets value to data, value must have the same type as cell
-// Returns true, if value has changed
-TGP.SetValue = function(row,col,Value,refresh,master,noupload,nocopyto,noid,nochg,always,updh,CP){
-
-var val = Get(row,col), id = row.id; 
-if(this.GetAttr(row,col,"CaseSensitiveValues")==0) {
-   if(typeof(Value)=="string") Value = Value.toLocaleLowerCase();
-   if(typeof(val)=="string") val = val.toLocaleLowerCase();
-   }
-if(this.SortRanges && Value && this.IsRange(row,col)) Value = this.SortRange(Value);
-if(Value==val && (Value+""==val+"" || Value===val) && (Value || isNaN(Value) || !isNaN(row[col]) || row[col]==null) || !Value&&!val&&isNaN(Value)&&isNaN(val)){ 
-   if(refresh==2||always&&refresh) { 
-      if(typeof(refresh)=="string") this.RefreshCellAnimate(row,col,refresh,updh); 
-      else this.RefreshCell(row,col); 
-      if(this.ColorState&2) this.ColorRow(row); 
-      }
-   return false; 
-   }
-if(this.Undo) this.UndoStart();
-var rchg = row.Changed;
-if(!row.CPage && !nochg){
-   nochg = this.GetAttr(row,col,"NoChanged");
-   if(this.StoreOriginalValues && !nochg && !row[col+"Changed"]) {
-      if(this.SortRanges==2 && val && this.IsRange(row,col)) val = this.SortRange(val);
-      if(row[col+"expr_val"]!=undefined){//****说明存在星号,需要转换
-       val=row[col+"expr_val"];//取星号对应的实际值
-      }
-      if(row[col+"_Link"]!=undefined){//****说明这个字段是超链接,需要同时更新col+"Link"的值
-       row[col+"Orig"] = row[col+"_Link"];//原值,不带a标签
-      }else if(row[col+"_Orig46"]!=undefined){//****说明这个字段是超链接,需要同时更新col+"Link"的值
-       row[col+"Orig"] = row[col+"_Link"];//原值,不带a标签
-      }else{
-      row[col+"Orig"] = val;//var原值,Value新值
-    	}
-      }
-   if(row.Kind!="Filter"){
-      var upl = !Is(row,"NoUpload"), und = Is(row,col+"Undo");
-         	//*****处理图片控件
-    	//console.log("Value:>>"+Value);
-    	if(this.Cols[col]&&this.Cols[col].Type=="Img"){
-    		if(Value!=undefined&&Value!=""){
-    			if(Value.indexOf("http")<0){
-    		var unids=Value.split(";");
-    		Value=this.createPicPath(Value);//"|/getImage.do?type=0&uuid="+unids[0]+";"+unids[1]+"&r="+Math.random()+"|48|48";
-    		//console.log("Value2:>>"+Value);
-    		row[col+"_Img"]=unids[0]+";"+unids[1];
-    		row[col+"_ImgType"]=unids[2];
-    	}
-    	}else{//删除
-    		row[col+"_Img"]="";
-    		row[col+"_ImgType"]="";
-    	}
-    	}
-    	//*****
-      if((upl&&!nochg&&und!="0"||(!upl||nochg)&&und-0) && !this.MasterGrid) this.AddUndo({ Type:"Change",Row:row,Col:col,OldVal:val,NewVal:Value,RowChanged:row.Changed,CellChanged:row[col+"Changed"]});
-      if(this.SaveOrder && upl&&!nochg) this.SetChange({ Row:row.id,Col:col,Val:Value });
-      }
-   else if(this.Undo&16) this.AddUndo({ Type:"Filter",Row:row,Col:col,OldVal:val,NewVal:Value});
-   if(!nochg){
-      row.Changed = 1;
-      row[col+"Changed"] = 1;
-      }
-   }
-
-MS.Pivot;
-if(this.PivotGrid && !master) this.SetPivotValue(row,col,Value);
-if(this.PivotDetail && !master){
-   for(var id in this.PivotDetail){
-      var G = this.PivotDetail[id];
-      if(G && !G.Loading && !G.Cleared && !G.Rendering) G.SetPivotDetailValue(row,col,Value);
-      }
-   }
-ME.Pivot;
-
-row[col] = Value-0+""==Value ? Value-0 : Value;
-
-MS.Master;
-if(master!=1 && row.MasterRow){ 
-   this.MasterGrid.SetValue(row.MasterRow,col,Value,1,row,noupload,0,null,nochg);
-   nocopyto = 1;
-   }
-if(row.DetailRow){ 
-   for(var i=0;i<row.DetailRow.length;i++) {
-      if(row.DetailRow[i]!=master && !row.DetailRow[i].Page) row.DetailGrid[i].SetValue(row.DetailRow[i],col,Value,1,1,noupload,1,null,nochg); 
-      }
-   }
-ME.Master;
-
-MS.Master;
-var cp = Get(row,col+"CopyTo");
-if(cp && !nocopyto){
-   if(!CP) CP = {}; 
-   CP[row.id+"$"+col] = 1;
-   cp = cp.split(',');
-   for(var i=0;i<cp.length;i+=2){
-      var r = null;
-      if(cp[i]=="Parent") r = row.Fixed||row.parentNode.Page ? null : row.parentNode;
-      else if(cp[i]=="Next") r = row.nextSibling;
-      else if(cp[i]=="Prev") r = row.previousSibling;
-      else if(this.Rows[cp[i]]) r = this.Rows[cp[i]];
-      else {
-         var s = cp[i].split('_'), p = null;
-         if(s[0]=="Child") p = row;
-         else if(s[0]=="Sibling") p = row.parentNode;
-         else if(s[0]=="Children"){
-            var T = this; function SetCh(row,col,def){
-               for(var r=row.firstChild;r;r=r.nextSibling) if((!def || r.Def.Name==def) && !CP[r.id+"$"+col]){ 
-                  T.SetValue(r,col,Value,1,0,noupload,null,null,nochg,null,null,CP);
-                  if(T.RefreshEnum) T.RefreshEnum(r,col);
-                  }
-               }
-            if(!row.firstChild && this.ChildPaging==3 && row.State==0){ 
-               var ccol = cp[i+1], cdef = s[1];
-               this.DownloadPage(row,function(result){
-                  T.PageLoaded(result,row);
-                  if(result>=0) SetCh(row,ccol,cdef);
-                  });
-               continue;
-               }
-            SetCh(row,cp[i+1],s[1]);
-            continue; 
-            }
-         if(p){
-            if(s[1]-0+""==s[1]) r = GetNode(p,s[1]);
-            else for(var r=p.firstChild;r;r=r.nextSibling) if(r.Def.Name==s[1]) break;
-            }
-         else r = this.GetRowById(cp[i]);
-         }
-      if(r && !CP[r.id+"$"+cp[i+1]]){ 
-         this.SetValue(r,cp[i+1],Value,1,0,noupload,null,null,nochg,null,null,CP);
-         if(this.RefreshEnum) this.RefreshEnum(r,cp[i+1]);
-         }
-      }
-   }
-ME.Master;
-
-MS.Group;
-MS.Tree;
-if(row.Def.Group && col==this.MainCol){ 
-   var T = this, gc = this.GetGroupCol(row), gp = row.GroupPos, ch = gp!=null?this.Cols[gc].GroupChar:null;
-   
-   function SetGroupValue(row){ 
-      for(var r=row.firstChild;r;r=r.nextSibling){
-         if(r.Def && r.Def.Group) SetGroupValue(r);
-         else {
-            var v = Value;
-            if(gp!=null){
-               v = Get(r,gc);
-               if(v) { v = v.split(ch); v[gp] = Value; v = v.join(ch); }
-               else v = Value;
-               }
-            T.SetValue(r,gc,v,1,0,noupload,null,null,nochg);
-            }
-         }
-      }
-   SetGroupValue(row);
-   if(this.AutoUpdate){ 
-      row.Changed = null;
-      row[col+"Changed"] = null;
-      }
-   }
-ME.Tree;
-ME.Group;
-
-MS.Cfg;
-if(this.SaveAttrs) this.SaveAttrsCfg(row,col);
-ME.Cfg;
-
-MS.CPages;
-var fr = row.firstChild;
-if(fr && fr.CPage){
-   for(;fr;fr=fr.nextSibling) this.SetValue(fr,col,Value,1,1,noupload,null,null,nochg); 
-   }
-ME.CPages;
-
-if(!noupload && !nochg) this.DoAction(row,col);
-this.RunAction("Change","","",row,col);
-
-if(this.StoreOriginalValues && !nochg){  
-   var oval = row[col+"Orig"];
-   
-   if(refresh!=-1&&Value==oval && (Value&&Value+""==oval+"" || Value===oval)) { //***refresh!=-1
-      row[col+"Changed"] = null;
-      var ch = 0;
-      for(var cc in this.Cols) if(row[cc+"Changed"]){ ch = 1; break; }
-      if(!ch) row.Changed = null;
-      }
-   }
-
-MS.Gantt;
-MS.GanttResources; 
-if(this.ResourcesGrid){
-   var G = this.ResourcesGrid;
-   if(col==this.GanttResourcesName){
-      var rr = G.Resources[val];
-      if(rr) {
-         rr.Name = Value;
-         delete G.Resources[val];
-         G.Resources[Value] = rr;
-         var sep = this.Lang.Format.ValueSeparator, gc = this.ResourcesCol;
-         var reg = new RegExp("(^|[\\"+sep+"])("+ToRegExp(val)+")($|[\\"+sep+"\\"+this.Lang.Format.AddSeparator+"\\"+this.Lang.Format.CountSeparator+"])");
-         for(var r=G.GetFirst();r;r=G.GetNext(r)){
-            var rc = G.GetGanttCol(r,gc,"Resources");
-            if(rc){
-               var rv = Get(r,rc);
-               if(rv && (rv+"").indexOf(val)>=0){
-                  r[rc] = (rv+"").replace(reg,"$1"+Value+"$3");
-                  G.RefreshCell(r,rc);
-                  }
-               }
-            }
-         G.Calculate(1);
-         row[this.GanttResourcesChart+"GanttChartResource"] = Value;
-         }
-      }
-   else if(col==this.GanttResourcesPrice){
-      var rr = G.Resources[row[this.GanttResourcesName]];
-      if(rr) {
-         rr.Price = Value;
-         G.Calculate(1);
-         }
-      }   
-   else if(col==this.GanttResourcesAvailability){
-      var rr = G.Resources[row[this.GanttResourcesName]];
-      if(rr) rr.Availability = Value;
-      
-      }   
-   else if(col==this.GanttResourcesType){
-      var rr = G.Resources[row[this.GanttResourcesName]];
-      if(rr) rr.Type = Value;
-      
-      } 
-   }
-ME.GanttResources; 
-ME.Gantt;
- 
-if(this.IdTypes && this.IdTypes[col] && !noid) this.SetIdUnique(row);
-if(row.Kind!="Filter" && noupload!=1) this.Recalculate(row,col,true);
-
-MS.Upload;
-if(!master && !noupload) { 
-   if(row.MasterRow) this.MasterGrid.UploadChanges(row.MasterRow);
-   else this.UploadChanges(row);
-   }
-ME.Upload;
-
-MS.Space;
-if(row.Space && Get(row,col+"Width")==-2) {
-   var cell = this.GetCell(row,col);
-   if(cell) {
-      if(cell.lastChild && cell.lastChild.nodeType==1) cell = cell.lastChild;
-      var w = cell.offsetWidth, s = GetStyle(cell);
-      if(s&&w) row[col+"Width"] = w-GetBorderWidth(s);
-      }
-   }
-ME.Space;
-
-MS.Chart; if(this.Charts) this.UpdateCharts(row,col); ME.Chart;
-
-if(refresh) { 
-   this.WaitForCtrC = 0; 
-   if(typeof(refresh)=="string") this.RefreshCellAnimate(row,col,refresh,updh); 
-   else this.RefreshCell(row,col); 
-   if(this.ColorState&2 && rchg!=row.Changed) this.ColorRow(row); 
-   }
-if(this.Undo) this.UndoEnd();
-return true;
-}
-// -----------------------------------------------------------------------------------------------------------
-// -----------------------------------------------------------------------------------------------------------
diff --git a/core.js b/core.js
index 56a3505..63d3d3e 100644
--- a/core.js
+++ b/core.js
@@ -2107,21 +2107,10 @@
 		} catch (e) { }
 		var sf = GT.threePop.setupParms(to, tep, df, filter, _.id, alue, _.formParm, rec, " like", false, false, true, false, this.Data.seInfo, null, null, null, null, this);
 		this.setGridInfoTOPop(_, this, row);
-		// if (_.colType != undefined && _.colType == 46) {
-		// 	//鎵撳紑搴忓垪鍙锋壂鐮佺晫闈�
-		// 	sf += "@p@" + this.id;
-		// 	showLayerGrid("/general/SerialNumber/warehousing.jsp" + sf, "-1");
-		// } else {
 			_.path = _.path.replace("#spellPath#", spellPath);
 			parent.addTab("", _.formid, _.wtype, "", _.path + sf);
-		//}
 	} else {
-		// if(_.colType==46){
-		// 	document.getElementById(_.Name+"_color").click();
-		// 	return;
-		// }else{
 		this.popAttr(_, row, col, 1);
-		//}
 	}
 
 };
@@ -3111,7 +3100,13 @@
 	for (var c in this.Cols) {
 		if(this.Cols[c].colType==46){
 			V[c+"CanEdit"]=0;
-			V[c+"HtmlPrefix"]="<div style=\"background:#ffffff\"><input title=\"&#x53CC;&#x51FB;&#x9009;&#x53D6;&#x989C;&#x8272;\" type=\"color\"  style=\"width: 100%;height:25;border: none;\" value=\"#ffffff\" id=\""+c+"_color\" onchange=\"Grids["+this.Index+"].setcolorby46(this);\"/></div>";
+			V[c+"HtmlPrefix"]="<div style=\"background:#ffffff\"><input title=\"&#x53CC;&#x51FB;&#x9009;&#x53D6;&#x989C;&#x8272;\" type=\"color\"  style=\"width: 100%;height:25;border: none;\" value=\"#ffffff\" id=\""+c+"_color\" onchange=\"Grids["+this.Index+"].setcolorby46(this);\"/>";
+			V[c+"HtmlPostfix"]="</div>";
+		}
+		if(this.Cols[c].colType==47){
+			V[c+"CanEdit"]=0;
+			V[c+"HtmlPrefix"]="<div class=\"progress\" style=\"height: 25;\"><div class=\"progress-bar\" style=\"width:0%\"></div>";
+			V[c+"HtmlPostfix"]="</div>";
 		}
 	}
 	this.RefreshRow(V);
@@ -3852,14 +3847,19 @@
 				A[cl.Name+"_Orig46"]=A[cl.Name];
 				A[cl.Name]="";
 			}
-
-			A[cl.Name+"CanEdit"]=0;
+			if(cl.CanEdit==0){
+				//鐩存帴璁剧疆鍙鐨勬儏鍐碉紝澧炲姞杩欎釜鏍囪
+				cl.is46OnlyRead=1
+			}
+			A[cl.Name+"CanEdit"]=0;//涓嶇鏈夋病璁剧疆鍙涔熻璁剧疆涓哄彧璇�
 			if(cl.is46OnlyRead==1){
 				//鍙鎯呭喌
-				A[cl.Name+"HtmlPrefix"]="<div style=\"background:"+color+";width: 100%;height:25;border: none;\"></div>";
+				A[cl.Name+"HtmlPrefix"]="<div style=\"background:"+color+";width: 100%;height:25;border: none;\">";
+				A[cl.Name+"HtmlPostfix"]="</div>";
 			
 			}else{
-			    A[cl.Name + "HtmlPrefix"]="<div style=\"background:"+color+"\"><input title=\"&#x53CC;&#x51FB;&#x9009;&#x53D6;&#x989C;&#x8272;\" type=\"color\"  style=\"width: 100%;height:25;border: none;\" value=\""+color+"\" id=\""+cl.Name+"_color\" onchange=\"Grids["+this.Index+"].setcolorby46(this);\"/></div>";
+			    A[cl.Name + "HtmlPrefix"]="<div style=\"height:25;background:"+color+"\"><input title=\"&#x53CC;&#x51FB;&#x9009;&#x53D6;&#x989C;&#x8272;\" type=\"color\"  style=\"width: 100%;height:25;border: none;\" value=\""+color+"\" id=\""+cl.Name+"_color\" onchange=\"Grids["+this.Index+"].setcolorby46(this);\"/>";
+				A[cl.Name+"HtmlPostfix"]="</div>";
 			}
 		}
 		if(cl.colType==47){
@@ -3872,9 +3872,14 @@
 			}
 			progress=progress>1?1:progress;
 			progress=progress<0?0:progress;
-			A[cl.Name]="";
+			A[cl.Name]=null;
 			A[cl.Name+"CanEdit"]=0;
-			A[cl.Name + "HtmlPrefix"]="<div class=\"progress\" style=\"height: 25;\"><div class=\"progress-bar\" style=\"width:"+(progress*100)+"%\">"+(progress*100)+"%</div></div>";
+			var htmlperfix="<div class=\"progress\" style=\"position: relative;height: 25;\"><div class=\"progress-bar\" style=\"width:"+(progress*100)+"%\"></div>";
+			if(progress>0){
+				htmlperfix+="<div style=\"line-height: 25px;position: absolute;float: left;left: 50%;\">"+(progress*100)+"%</div>";
+			}
+			A[cl.Name + "HtmlPrefix"]=htmlperfix;
+			A[cl.Name+"HtmlPostfix"]="</div>";
 		}
 		//澶勭悊瓒呴摼鎺ラ棶棰橈紝鎵嬫満绔拰PC绔渶瑕佺敤涓嶅悓鐨勬柟寮�
 		if (this.browserRedirect()) {
@@ -5659,6 +5664,7 @@
 				result = (n1 * n2) / (t1 * t2)
 				return result
 			case 'divide':
+				//console.log("divide:(n1 / n2) / (t2/ t1)="+n1+","+n2+","+t1+","+t2);
 				result = (n1 / n2) * (t2 / t1)
 				return result
 		}

--
Gitblit v1.8.0