00405f3a7e6fed8883c1b651a77bb403aae4f7be.svn-base 125 KB

1234
  1. var widthModifyFlag=0;var checkedArrayEditor=[];var checkedTextArrayEditor=[];var currentEditorId="id";var currentEditorName="name";function findCheckedArrayEditor(e){for(var t=0;t<checkedArrayEditor.length;t++){if(checkedArrayEditor[t]==e)return t}return-1}function addCheckedArrayEditor(e,t){if(findCheckedArrayEditor(e)==-1){checkedArrayEditor.push(e);checkedTextArrayEditor.push(t)}}function removeCheckedArrayEditor(e){var t=findCheckedArrayEditor(e);if(t==-1)return;checkedArrayEditor.splice(t,1);checkedTextArrayEditor.splice(t,1)}function checkedHandlerEditor(e){if(findCheckedArrayEditor(e[currentEditorId])==-1)return false;return true}function checkRowHandlerEditor(e,t){if(e)addCheckedArrayEditor(t[currentEditorId],t[currentEditorName]);else removeCheckedArrayEditor(t[currentEditorId],t[currentEditorName])}function checkAllRowHandlerEditor(e){for(var t in this.records){if(e)addCheckedArrayEditor(this.records[t][currentEditorId],this.records[t][currentEditorName]);else removeCheckedArrayEditor(this.records[t][currentEditorId],this.records[t][currentEditorName])}}(function($){var l=$.quiui;$.fn.quiGrid=function(e){return $.quiui.run.call(this,"quiGrid",arguments)};$.fn.quiGetGridManager=function(){return $.quiui.run.call(this,"quiGetGridManager",arguments)};var gridHeaderHeight=26;var gridRowHeight=26;if($("#skin").attr("splitMode")==true||$("#skin").attr("splitMode")=="true"){}else{var $parentThemeDom=$(window.top.document.getElementById("theme"));if($parentThemeDom.attr("gridHeaderHeight")!=null){gridHeaderHeight=Number($parentThemeDom.attr("gridHeaderHeight"))}if($parentThemeDom.attr("defaultGridHeaderHeight")!=null){gridHeaderHeight=Number($parentThemeDom.attr("defaultGridHeaderHeight"))}if($parentThemeDom.attr("gridRowHeight")!=null){gridRowHeight=Number($parentThemeDom.attr("gridRowHeight"))}if($parentThemeDom.attr("defaultGridRowHeight")!=null){gridRowHeight=Number($parentThemeDom.attr("defaultGridRowHeight"))}}$.quiDefaults.Grid={title:null,width:"auto",height:"auto",columnWidth:null,resizable:true,url:false,usePager:true,page:1,pageSize:10,pageSizeOptions:[5,10,20,30,40,50],params:[],columns:[],minColToggle:1,dataType:"server",dataAction:"server",showTableToggleBtn:false,switchPageSizeApplyComboBox:false,allowAdjustColWidth:true,checkbox:false,allowHideColumn:true,enabledEdit:false,isScroll:true,onDragCol:null,onToggleCol:null,onChangeSort:null,onSuccess:null,onDblClickRow:null,onSelectRow:null,onUnSelectRow:null,onBeforeCheckRow:null,onCheckRow:null,onBeforeCheckAllRow:null,onCheckAllRow:null,onBeforeShowData:null,onAfterShowData:null,onError:null,onSubmit:null,dateFormat:"yyyy-MM-dd",InWindow:true,statusName:"__status",method:"post",async:true,fixedCellHeight:true,heightDiff:-10,cssClass:null,root:"rows",record:"pager.totalRows",pageParmName:"pager.pageNo",pagesizeParmName:"pager.pageSize",sortnameParmName:"sort",sortorderParmName:"direction",onReload:null,onToFirst:null,onToPrev:null,onToNext:null,onToLast:null,allowUnSelectRow:false,alternatingRow:true,mouseoverRowCssClass:"l-grid-row-over",enabledSort:true,rowAttrRender:null,groupColumnName:null,groupColumnDisplay:"分组",groupRender:null,totalRender:null,delayLoad:false,where:null,selectRowButtonOnly:true,onAfterAddRow:null,onBeforeEdit:null,onBeforeSubmitEdit:null,onAfterEdit:null,onLoading:null,onLoaded:null,onContextmenu:null,whenRClickToSelect:false,contentType:null,checkboxColWidth:27,detailColWidth:29,clickToEdit:true,detailToEdit:false,onEndEdit:null,minColumnWidth:80,tree:null,isChecked:null,frozen:true,frozenDetail:false,frozenCheckbox:true,detailHeight:260,rownumbers:false,frozenRownumbers:true,rownumbersColWidth:40,colDraggable:true,rowDraggable:false,rowDraggingRender:null,autoCheckChildren:true,onRowDragDrop:null,rowHeight:gridRowHeight,headerRowHeight:gridHeaderHeight,toolbar:null,headerImg:null,totalType:"auto",oldTotalWidth:100,percentWidthMode:false,multihead:false,showPageInfo:true,showPageSize:true,treeExpandAll:false,detailRemory:true,detailClickExpand:false,detailCloseOther:true,treeAjax:false,treeChildDataPath:"",treeAutoParam:"",treeDataFilter:null,showTitle:false,excelMode:false,showHeader:true,noSelecton:false,filterParams:[]};$.quiDefaults.GridString={errorMessage:quiLangage.quiGrid.errorMessage,pageStatMessage:quiLangage.quiGrid.pageStatMessage,pageTextMessage:quiLangage.quiGrid.pageTextMessage,loadingMessage:quiLangage.quiGrid.loadingMessage,findTextMessage:quiLangage.quiGrid.findTextMessage,noRecordMessage:quiLangage.quiGrid.noRecordMessage,isContinueByDataChanged:quiLangage.quiGrid.isContinueByDataChanged,cancelMessage:quiLangage.quiGrid.cancelMessage,saveMessage:quiLangage.quiGrid.saveMessage,applyMessage:quiLangage.quiGrid.applyMessage,draggingMessage:quiLangage.quiGrid.draggingMessage};$.quiMethos.Grid=$.quiMethos.Grid||{};$.quiDefaults.Grid.sorters=$.quiDefaults.Grid.sorters||{};$.quiDefaults.Grid.formatters=$.quiDefaults.Grid.formatters||{};$.quiDefaults.Grid.editors=$.quiDefaults.Grid.editors||{};$.quiDefaults.Grid.sorters["date"]=function(e,t){return e<t?-1:e>t?1:0};$.quiDefaults.Grid.sorters["int"]=function(e,t){return parseInt(e)<parseInt(t)?-1:parseInt(e)>parseInt(t)?1:0};$.quiDefaults.Grid.sorters["float"]=function(e,t){return parseFloat(e)<parseFloat(t)?-1:parseFloat(e)>parseFloat(t)?1:0};$.quiDefaults.Grid.sorters["string"]=function(e,t){return e.localeCompare(t)};$.quiDefaults.Grid.formatters["date"]=function(value,column){function getFormatDate(e,t){var i=this,r=this.options;if(isNaN(e))return null;var l=t;var a={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};if(/(y+)/.test(l)){l=l.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))}for(var o in a){if(new RegExp("("+o+")").test(l)){l=l.replace(RegExp.$1,RegExp.$1.length==1?a[o]:("00"+a[o]).substr((""+a[o]).length))}}return l}if(!value)return"";if(typeof value=="string"&&/^\/Date/.test(value)){value=value.replace(/^\//,"new ").replace(/\/$/,"");eval("value = "+value)}if(value instanceof Date){var format=column.format||this.options.dateFormat||"yyyy-MM-dd";return getFormatDate(value,format)}else{return value.toString()}};$.quiDefaults.Grid.editors["text"]={create:function(container,editParm){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input;if(column.editor.detailEdit==true){input=$("<input type='text'/>");container.width("auto").height(30)}else{input=$("<input type='text' />");container.height("auto")}if(column.editor.width){input.width(column.editor.width)}if(column.editor.maxlength){input.attr("maxlength",column.editor.maxlength)}if(column.editor.inputMode){input.attr("inputMode",column.editor.inputMode)}container.append(input);input.render();if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn")});input.addClass("float_left")}return input}},getValue:function(e,t){return e.val()},setValue:function(e,t,i){e.val(t)},resize:function(e,t,i,r){var l=r.column;if(l.editor.detailEdit==true){}else{if(l.editor.tip){e.width(t-28)}else{e.width(t-4)}}e.focus()},destroy:function(e,t){e.qui("destroy")}};$.quiDefaults.Grid.editors["textarea"]={create:function(container,editParm){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input;if(column.editor.detailEdit==true){input=$("<textarea class='textarea'/>")}else{input=$("<textarea style='border:0;'/>")}container.width("auto").height("auto");if(column.editor.width){input.width(column.editor.width)}if(column.editor.height){input.height(column.editor.height)}container.append(input);if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn")});input.addClass("float_left")}return input}},getValue:function(e,t){return e.val()},setValue:function(e,t,i){e.val(t)},resize:function(e,t,i,r){var l=r.column;if(l.editor.detailEdit==true){}else{if(l.editor.tip){e.width(t-28)}else{e.width(t-4)}e.height(i-3)}e.focus()},destroy:function(e,t){e.qui("destroy")}};$.quiDefaults.Grid.editors["date"]={create:function(container,editParm,g,p){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input;if(column.editor.detailEdit==true){input=$("<input type='text' class='date'/>");container.width("auto").height(30)}else{input=$("<input type='text' class='date'/>");container.height("auto")}if(column.editor.dateFmt){input.attr("dateFmt",column.editor.dateFmt)}if(column.editor.width){input.width(column.editor.width)}if(column.editor.doubleCal==true){input.attr("doubleCal",true)}container.append(input);if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn")});input.addClass("float_left")}input.css("fontFamily",fontFamily);input.css("fontSize",fontSize);var dateFormat="yyyy-MM-dd";if(input.attr("dateFmt")!=null){dateFormat=input.attr("dateFmt")}var doubleCal=false;if(input.attr("doubleCal")==true||input.attr("doubleCal")=="true"){doubleCal=true}if(p.excelMode){$(document).unbind("keydown.grid")}input.click(function(){try{WdatePicker({skin:themeColor,isShowClear:true,dateFmt:dateFormat,doubleCalendar:doubleCal,onpicked:function(e){input.blur();if(p.excelMode){$(document).bind("keydown.grid",function(e){g._onKeyDown.call(g,e)})}}})}catch(e){alert(uncompile(quiLanguage.jsError.WdatePicker))}});if(p.clickToEdit){setTimeout(function(){input.focus()},500)}return input}},getValue:function(e,t){return e.val()},setValue:function(e,t,i,r,l){e.val(t);if(l.clickToEdit){e.attr("id","dateEditor1");var a=i.column;if(a.editor.dateFmt){e.attr("dateFmt",a.editor.dateFmt)}if(a.editor.doubleCal==true){e.attr("doubleCal",true)}var o="yyyy-MM-dd";if(e.attr("dateFmt")!=null){o=e.attr("dateFmt")}var n=false;if(e.attr("doubleCal")==true||e.attr("doubleCal")=="true"){n=true}try{WdatePicker({skin:themeColor,isShowClear:true,dateFmt:o,doubleCalendar:n,el:"dateEditor1",onpicked:function(t){e.blur();if(l.excelMode){$(document).bind("keydown.grid",function(e){r._onKeyDown.call(r,e)})}}})}catch(d){alert(uncompile(quiLanguage.jsError.WdatePicker))}}},resize:function(e,t,i,r){var l=r.column;if(l.editor.detailEdit==true){}else{if(l.editor.tip){e.width(t-28)}else{e.width(t-4)}}},destroy:function(e,t){e.qui("destroy")}};$.quiDefaults.Grid.editors["select"]={create:function(container,editParm,g,p){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input=$("<select></select>");if(column.editor.hidePrompt){}else{input.attr("prompt",quiLangage.quiGrid.editorPromptMessage)}if(column.editor.detailEdit==true){container.width("auto").height(30)}else{container.height("auto")}if(column.editor.data){input.data("data",column.editor.data);input.attr("selectedValue",editParm.value)}else if(column.editor.url){input.attr("url",column.editor.url);input.attr("selectedValue",editParm.value)}if(column.editor.selWidth){input.attr("selWidth",column.editor.selWidth)}if(column.editor.boxWidth){input.attr("boxWidth",column.editor.boxWidth)}if(column.editor.prompt){input.attr("prompt",column.editor.prompt)}if(column.editor.boxHeight){input.attr("boxHeight",column.editor.boxHeight)}if(column.editor.openDirection){input.attr("openDirection",column.editor.openDirection)}if(column.editor.editable){input.attr("editable",column.editor.editable)}if(column.editor.colNum){input.attr("colNum",column.editor.colNum)}if(column.editor.colWidth){input.attr("colWidth",column.editor.colWidth)}if(column.editor.valueField){input.attr("valueField",column.editor.valueField)}if(column.editor.labelField){input.attr("labelField",column.editor.labelField)}container.append(input);if(column.editor.link==true){var childSelData;var url;if(column.editor.relation=="child"){var parentSelValue=input.parent("td").prev("td").find("select").val();var fun=column.editor.linkHandler;if(column.editor.childDataPath){url=column.editor.childDataPath+parentSelValue;$.post(url,{},function(e){childSelData=e;input.data("data",childSelData);input.attr("selectedValue",editParm.value);input.render();if(typeof fun=="function"){fun.apply(null,[childSelData])}},"json")}else{if(typeof fun=="function"){childSelData=fun.apply(null,[parentSelValue])}input.data("data",childSelData);input.render()}}else if(column.editor.relation=="parent"){input.bind("change",function(){var e=input.parent("td").next("td").find("select");var t=column.editor.linkHandler;if(column.editor.childDataPath){url=column.editor.childDataPath+input.val();$.post(url,{},function(i){childSelData=i;e.data("data",childSelData);e.attr("selectedValue",editParm.value);e.render();if(typeof t=="function"){t.apply(null,[childSelData])}},"json")}else{if(typeof t=="function"){childSelData=t.apply(null,[input.val()])}e.data("data",childSelData);e.render()}});input.render()}}else{input.render()}if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn")})}if(p.clickToEdit){input.prev("div").find("input[type=text]").click()}return input}},getValue:function(e,t){var i="";if(e.attr("editable")=="true"){i=e.attr("editValue")}else{i=e.val()}return i},setValue:function(e,t,i){e.val(t)},resize:function(e,t,i,r){},destroy:function(e,t){e.qui("destroy")}};$.quiDefaults.Grid.editors["selectTree"]={create:function(container,editParm,g,p){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input=$("<div class='selectTree'></div>");if(column.editor.detailEdit==true){container.width("auto").height(30)}else{container.height("auto")}if(column.editor.data){input.data("data",column.editor.data);input.attr("selectedValue",editParm.value)}else if(column.editor.url){input.attr("url",column.editor.url);input.attr("selectedValue",editParm.value)}if(column.editor.selWidth){input.attr("selWidth",column.editor.selWidth)}if(column.editor.boxWidth){input.attr("boxWidth",column.editor.boxWidth)}if(column.editor.multiMode==true){input.attr("multiMode","true")}if(column.editor.noGroup==true){input.attr("noGroup","true")}if(column.editor.showInfo==true){input.attr("showInfo","true")}else{input.attr("showInfo","false")}if(column.editor.prompt){input.attr("prompt",column.editor.prompt)}if(column.editor.boxHeight){input.attr("boxHeight",column.editor.boxHeight)}if(column.editor.openDirection){input.attr("openDirection",column.editor.openDirection)}if(column.editor.editable){input.attr("editable",column.editor.editable)}if(column.editor.allSelectable){input.attr("allSelectable",column.editor.allSelectable)}if(column.editor.exceptParent){input.attr("exceptParent",column.editor.exceptParent)}container.append(input);if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn")})}input.render();if(p.clickToEdit){setTimeout(function(){input.find("input[type=text]").click()},200)}return input}},getValue:function(e,t){var i="";if(e.attr("editable")=="true"){i=e.attr("editValue")}else{i=e.attr("relValue")}return i},setValue:function(e,t,i){e.setValue(t)},resize:function(e,t,i,r){},destroy:function(e,t){e.qui("destroy")}};$.quiDefaults.Grid.editors["selectCustom"]={create:function(container,editParm,g,p,value){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input=$("<div class='selectCustom'></div>");if(column.editor.detailEdit==true){container.width("auto").height(30)}else{container.height("auto")}if(column.editor.selWidth){input.attr("selWidth",column.editor.selWidth)}if(column.editor.boxWidth){input.attr("boxWidth",column.editor.boxWidth)}if(column.editor.showInfo==true){input.attr("showInfo","true")}else{input.attr("showInfo","false")}if(column.editor.prompt){input.attr("prompt",column.editor.prompt)}if(column.editor.boxHeight){input.attr("boxHeight",column.editor.boxHeight)}if(column.editor.openDirection){input.attr("openDirection",column.editor.openDirection)}var child=$("<div></div>");container.append(input);input.append(child);if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn")})}if(column.editor.child){if(column.editor.child.type=="filter"){child.addClass("filter")}else if(column.editor.child.type=="grid"){child.addClass("grid")}else if(column.editor.child.type=="lister"){child.addClass("lister")}else if(column.editor.child.type=="listerTree"){child.addClass("listerTree")}}input.render();if(column.editor.child){if(column.editor.child.type=="filter"){child=input.find(".filter");if(column.editor.data){child.data("data",column.editor.data);child.attr("selectedValue",editParm.value)}else if(column.editor.url){child.attr("url",column.editor.url);child.attr("selectedValue",editParm.value)}if(column.editor.child.multiMode==true){child.attr("multiMode","true")}if(column.editor.child.groupMode==true){child.attr("groupMode","true")}if(column.editor.child.itemWidth){child.attr("itemWidth",column.editor.child.itemWidth)}if(column.editor.child.itemHeight){child.attr("itemHeight",column.editor.child.itemHeight)}if(column.editor.child.filterWidth){child.attr("filterWidth",column.editor.child.filterWidth)}if(column.editor.child.showTip==true){child.attr("showTip","true")}if(column.editor.child.showInfo==true){child.attr("showInfo","true")}child.render()}else if(column.editor.child.type=="lister"){child=input.find(".lister");if(column.editor.data){child.data("data",column.editor.data)}else if(column.editor.url){child.attr("url",column.editor.url)}if(value){child.attr("selectedValue",value)}else{child.attr("selectedValue","")}if(column.editor.child.fromTitle){child.attr("fromTitle",column.editor.child.fromTitle)}if(column.editor.child.toTitle){child.attr("toTitle",column.editor.child.toTitle)}if(column.editor.child.listerWidth){child.attr("listerWidth",column.editor.child.listerWidth)}if(column.editor.child.listerHeight){child.attr("listerHeight",column.editor.child.listerHeight)}if(column.editor.child.maxSelection){child.attr("maxSelection",column.editor.child.maxSelection)}child.render()}else if(column.editor.child.type=="listerTree"){child=input.find(".listerTree");if(column.editor.data){child.data("data",column.editor.data)}else if(column.editor.url){child.attr("url",column.editor.url)}if(value){child.attr("selectedValue",value)}else{child.attr("selectedValue","")}if(column.editor.child.fromTitle){child.attr("fromTitle",column.editor.child.fromTitle)}if(column.editor.child.toTitle){child.attr("toTitle",column.editor.child.toTitle)}if(column.editor.child.listerWidth){child.attr("listerWidth",column.editor.child.listerWidth)}if(column.editor.child.listerHeight){child.attr("listerHeight",column.editor.child.listerHeight)}if(column.editor.child.asyncMode==true){child.attr("asyncMode","true")}if(column.editor.child.autoParam){child.attr("autoParam",column.editor.child.autoParam)}child.render()}else if(column.editor.child.type=="grid"){checkedArrayEditor=[];checkedTextArrayEditor=[];if(value){var valueArray=value.split(",");for(var i=0;i<valueArray.length;i++){checkedArrayEditor.push(valueArray[i])}}var myEditorGrid;child=input.find(".grid");var gridurl=null;if(column.editor.url){gridurl=column.editor.url}var griddata=null;if(column.editor.data){griddata=column.editor.data}var gridcolums=null;if(column.editor.child.columns){gridcolumns=column.editor.child.columns}var gridheight=p.height;if(column.editor.child.height){gridheight=column.editor.child.height}var gridfixedCellHeight=p.fixedCellHeight;if(column.editor.child.fixedCellHeight!=null){gridfixedCellHeight=column.editor.child.fixedCellHeight}var growHeight=gridRowHeight;if(column.editor.child.rowHeight){gridheight=column.editor.child.rowHeight}var gheaderRowHeight=gridHeaderHeight;if(column.editor.child.headerRowHeight){gheaderRowHeight=column.editor.child.headerRowHeight}var gridwidth=p.width;if(column.editor.child.width){gridwidth=column.editor.child.width}var gridcolumnWidth=p.columnWidth;if(column.editor.child.columnWidth){gridcolumnWidth=column.editor.child.columnWidth}var gridminColumnWidth=p.minColumnWidth;if(column.editor.child.minColumnWidth){gridminColumnWidth=column.editor.child.minColumnWidth}var gridpercentWidthMode=p.percentWidthMode;if(column.editor.child.percentWidthMode!=null){gridpercentWidthMode=column.editor.child.percentWidthMode}var gridparams=p.params;if(column.editor.child.params){gridparams=column.editor.child.params}var gridusePager=p.usePager;if(column.editor.child.usePager!=null){gridusePager=column.editor.child.usePager}var gridpage=p.page;if(column.editor.child.page){gridpage=column.editor.child.page}var gridpageSize=p.pageSize;if(column.editor.child.pageSize){gridpageSize=column.editor.child.pageSize}var gridpageSizeOptions=p.pageSizeOptions;if(column.editor.child.pageSizeOptions){gridpageSizeOptions=column.editor.child.pageSizeOptions}var gridshowPageInfo=p.showPageInfo;if(column.editor.child.showPageInfo!=null){gridshowPageInfo=column.editor.child.showPageInfo}var gridshowPageSize=p.showPageSize;if(column.editor.child.showPageSize!=null){gridshowPageSize=column.editor.child.showPageSize}var gridsortName=p.sortName;if(column.editor.child.sortName){gridsortName=column.editor.child.sortName}var gridsortOrder=p.sortOrder;if(column.editor.child.sortOrder){gridsortOrder=column.editor.child.sortOrder}var gridfrozen=p.frozen;if(column.editor.child.frozen!=null){gridfrozen=column.editor.child.frozen}var gridtitle=p.title;if(column.editor.child.title){gridtitle=column.editor.child.title}var gridenabledSort=p.enabledSort;if(column.editor.child.enabledSort!=null){gridenabledSort=column.editor.child.enabledSort}var gridalternatingRow=p.alternatingRow;if(column.editor.child.alternatingRow!=null){gridalternatingRow=column.editor.child.alternatingRow}var gridmultihead=p.multihead;if(column.editor.child.multihead!=null){gridmultihead=column.editor.child.multihead}var gridrownumbers=p.rownumbers;if(column.editor.child.rownumbers!=null){gridrownumbers=column.editor.child.rownumbers}var gridfrozenRownumbers=p.frozenRownumbers;if(column.editor.child.frozenRownumbers!=null){gridfrozenRownumbers=column.editor.child.frozenRownumbers}var gridcheckbox=p.checkbox;if(column.editor.child.checkbox!=null){gridcheckbox=column.editor.child.checkbox}var gridselectRowButtonOnly=p.selectRowButtonOnly;if(column.editor.child.selectRowButtonOnly!=null){gridselectRowButtonOnly=column.editor.child.selectRowButtonOnly}var gridfrozenCheckbox=p.frozenCheckbox;if(column.editor.child.frozenCheckbox!=null){gridfrozenCheckbox=column.editor.child.frozenCheckbox}var gridtreeExpandAll=p.treeExpandAll;if(column.editor.child.treeExpandAll!=null){gridtreeExpandAll=column.editor.child.treeExpandAll}var gridautoCheckChildren=p.autoCheckChildren;if(column.editor.child.autoCheckChildren!=null){gridautoCheckChildren=column.editor.child.autoCheckChildren}var gridtreeChildDataPath=p.treeChildDataPath;if(column.editor.child.treeChildDataPath){gridtreeChildDataPath=column.editor.child.treeChildDataPath}var gridtreeAjax=p.treeAjax;if(column.editor.child.treeAjax!=null){gridtreeAjax=column.editor.child.treeAjax}var gridtreeAutoParam=p.treeAutoParam;if(column.editor.child.treeAutoParam){gridtreeAutoParam=column.editor.child.treeAutoParam}var gridtreeDataFilter=p.treeDataFilter;if(column.editor.child.treeDataFilter){gridtreeDataFilter=column.editor.child.treeDataFilter}var gridisChecked=p.isChecked;if(column.editor.child.isChecked){gridisChecked=column.editor.child.isChecked}var gridonCheckRow=p.onCheckRow;if(column.editor.child.onCheckRow){gridonCheckRow=column.editor.child.onCheckRow}var gridonCheckAllRow=p.onCheckAllRow;if(column.editor.child.onCheckAllRow){gridonCheckAllRow=column.editor.child.onCheckAllRow}var gridTree=p.tree;if(column.editor.child.tree){gridTree=column.editor.child.tree}if(column.editor.child.valueField){currentEditorId=column.editor.child.valueField}if(column.editor.child.labelField){currentEditorName=column.editor.child.labelField}if(gridcolumns){if(griddata){myEditorGrid=child.quiGrid({columns:gridcolumns,data:griddata,height:gridheight,fixedCellHeight:gridfixedCellHeight,rowHeight:growHeight,headerRowHeight:gheaderRowHeight,width:gridwidth,columnWidth:gridcolumnWidth,minColumnWidth:gridminColumnWidth,percentWidthMode:gridpercentWidthMode,usePager:gridusePager,page:gridpage,pageSize:gridpageSize,pageSizeOptions:gridpageSizeOptions,showPageInfo:gridshowPageInfo,showPageSize:gridshowPageSize,sortName:gridsortName,sortOrder:gridsortOrder,frozen:gridfrozen,title:gridtitle,enabledSort:gridenabledSort,alternatingRow:gridalternatingRow,multihead:gridmultihead,rownumbers:gridrownumbers,frozenRownumbers:gridfrozenRownumbers,checkbox:gridcheckbox,selectRowButtonOnly:gridselectRowButtonOnly,frozenCheckbox:gridfrozenCheckbox,treeExpandAll:gridtreeExpandAll,autoCheckChildren:gridautoCheckChildren,treeAjax:gridtreeAjax,treeChildDataPath:gridtreeChildDataPath,treeAutoParam:gridtreeAutoParam,treeDataFilter:gridtreeDataFilter,isChecked:gridisChecked,onCheckRow:gridonCheckRow,onCheckAllRow:gridonCheckAllRow,tree:gridTree,onSelectRow:function(){if(!column.editor.multiMode){var e=myEditorGrid.getSelectedRow();input.find("input[type=text]").val(e[currentEditorName]);input.attr("relValue",e[currentEditorId]);input.attr("relText",e[currentEditorName]);input.selectCustomClose()}}})}else if(gridurl){myEditorGrid=child.quiGrid({columns:gridcolumns,url:gridurl,height:gridheight,fixedCellHeight:gridfixedCellHeight,rowHeight:growHeight,headerRowHeight:gheaderRowHeight,width:gridwidth,columnWidth:gridcolumnWidth,minColumnWidth:gridminColumnWidth,percentWidthMode:gridpercentWidthMode,params:gridparams,usePager:gridusePager,page:gridpage,pageSize:gridpageSize,pageSizeOptions:gridpageSizeOptions,showPageInfo:gridshowPageInfo,showPageSize:gridshowPageSize,sortName:gridsortName,sortOrder:gridsortOrder,frozen:gridfrozen,title:gridtitle,enabledSort:gridenabledSort,alternatingRow:gridalternatingRow,multihead:gridmultihead,rownumbers:gridrownumbers,frozenRownumbers:gridfrozenRownumbers,checkbox:gridcheckbox,selectRowButtonOnly:gridselectRowButtonOnly,frozenCheckbox:gridfrozenCheckbox,treeExpandAll:gridtreeExpandAll,autoCheckChildren:gridautoCheckChildren,treeAjax:gridtreeAjax,treeChildDataPath:gridtreeChildDataPath,treeAutoParam:gridtreeAutoParam,treeDataFilter:gridtreeDataFilter,isChecked:gridisChecked,onCheckRow:gridonCheckRow,onCheckAllRow:gridonCheckAllRow,tree:gridTree,onSelectRow:function(){if(!column.editor.multiMode){var e=myEditorGrid.getSelectedRow();input.find("input[type=text]").val(e[currentEditorName]);input.attr("relValue",e[currentEditorId]);input.attr("relText",e[currentEditorName]);input.selectCustomClose()}}})}}}if(column.editor.multiMode==true){input.bind("boxClose",function(){if(column.editor.child.type=="filter"||column.editor.child.type=="lister"||column.editor.child.type=="listerTree"){input.find("input[type=text]").val(child.attr("relText"));input.attr("relValue",child.attr("relValue"));input.attr("relText",child.attr("relText"))}else if(column.editor.child.type=="grid"){if(column.editor.multiMode){input.find("input[type=text]").val(checkedTextArrayEditor.join(","));input.attr("relValue",checkedArrayEditor.join(","));input.attr("relText",checkedTextArrayEditor.join(","))}}})}}if(p.clickToEdit){setTimeout(function(){input.find("input[type=text]").click()},200)}return input}},getValue:function(e,t){var i=e.attr("relValue");return i},setValue:function(e,t,i){},resize:function(e,t,i,r){},destroy:function(e,t){e.qui("destroy")}};$.quiDefaults.Grid.editors["suggestion"]={create:function(container,editParm,g,p){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input=$("<div class='suggestion'></div>");if(column.editor.detailEdit==true){container.width("auto").height(30)}else{container.height("auto")}if(column.editor.data){input.data("data",column.editor.data);if(column.editor.suggestMode=="remote"){input.attr("relText",editParm.value)}else{input.attr("selectedValue",editParm.value)}}else if(column.editor.url){input.attr("url",column.editor.url);if(column.editor.suggestMode=="remote"){input.attr("relText",editParm.value)}else{input.attr("selectedValue",editParm.value)}}if(column.editor.tab){input.data("tab",column.editor.tab)}if(column.editor.list){input.data("list",column.editor.list)}if(column.editor.suggestMode){input.attr("suggestMode",column.editor.suggestMode)}if(column.editor.prompt){input.attr("prompt",column.editor.prompt)}if(column.editor.inputWidth){input.attr("inputWidth",column.editor.inputWidth)}if(column.editor.boxWidth){input.attr("boxWidth",column.editor.boxWidth)}if(column.editor.boxHeight){input.attr("boxHeight",column.editor.boxHeight)}if(column.editor.openDirection){input.attr("openDirection",column.editor.openDirection)}if(column.editor.pageNum){input.attr("pageNum",column.editor.pageNum)}if(column.editor.pageCount){input.attr("pageCount",column.editor.pageCount)}if(column.editor.iconSrc){input.attr("iconSrc",column.editor.iconSrc)}if(column.editor.suggestTitle){input.attr("suggestTitle",column.editor.suggestTitle)}if(column.editor.showList==true){input.attr("showList",true)}if(column.editor.showMultiList){input.attr("showMultiList",true)}if(column.editor.colWidth){input.attr("colWidth",column.editor.colWidth)}if(column.editor.multiListWidth){input.attr("multiListWidth",column.editor.multiListWidth)}if(column.editor.multiListHeight){input.attr("multiListHeight",column.editor.multiListHeight)}if(column.editor.popTitle){input.attr("popTitle",column.editor.popTitle)}if(column.editor.autoCheck==false){input.attr("autoCheck",false)}if(column.editor.errorAlert==true){input.attr("errorAlert",true)}if(column.editor.errorMsg){input.attr("errorMsg",column.editor.errorMsg)}if(column.editor.minChars){input.attr("minChars",column.editor.minChars)}if(column.editor.delay){input.attr("delay",column.editor.delay)}if(column.editor.matchName){input.attr("matchName",column.editor.matchName)}container.append(input);if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn");
  2. })}input.render();if(p.clickToEdit){setTimeout(function(){input.find("input[type=text]").focus();input.find("input[type=text]").click()},200)}if(p.excelMode){input.bind("suggestOpen",function(){$(document).unbind("keydown.grid")});input.bind("suggestClose",function(){$(document).bind("keydown.grid",function(e){g._onKeyDown.call(g,e)})})}return input}},getValue:function(e,t){var i="";i=e.attr("relValue");return i},setValue:function(e,t,i){e.attr("selectedValue",t);e.render()},resize:function(e,t,i,r){},destroy:function(e,t){e.qui("destroy")}};$.quiDefaults.Grid.editors["stepper"]={create:function(container,editParm){if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))=="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){var column=editParm.column;var input=$("<input type='text' class='stepper'/>");if(column.editor.detailEdit==true){container.width("auto").height(30)}else{container.height("auto")}if(column.editor.width){input.width(column.editor.width)}if(column.editor.min){input.attr("min",column.editor.min)}if(column.editor.max){input.attr("max",column.editor.max)}if(column.editor.step){input.attr("step",column.editor.step)}container.append(input);input.render();if(column.editor.tip){var $light=$('<span class="img_light hand"></span>');container.append($light);$light.tip({auto:true,arrowDirection:"left",content:column.editor.tip});$light.hover(function(){$(this).removeClass("img_light");$(this).addClass("img_lightOn")},function(){$(this).addClass("img_light");$(this).removeClass("img_lightOn")});input.addClass("float_left")}return input}},getValue:function(e,t){return e.val()},setValue:function(e,t,i){e.val(t)},resize:function(e,t,i,r){var l=r.column;if(l.editor.detailEdit==true){}else{if(l.editor.tip){e.width(t-28)}else{e.width(t-4)}}},destroy:function(e,t){e.qui("destroy")}};$.quiui.controls.Grid=function(e,t){$.quiui.controls.Grid.base.constructor.call(this,e,t)};$.quiui.controls.Grid.quiExtend($.quiui.core.UIComponent,{__getType:function(){return"$.quiui.controls.Grid"},__idPrev:function(){return"grid"},_extendMethods:function(){return $.quiMethos.Grid},_init:function(){$.quiui.controls.Grid.base._init.call(this);var e=this,t=this.options;t.dataType=t.url?"server":"local";if(t.dataType=="local"){t.data=t.data||[];t.dataAction="local"}if(t.isScroll==false){t.height="auto"}if(!t.frozen){t.frozenCheckbox=false;t.frozenDetail=false;t.frozenRownumbers=false}if(t.detailToEdit){t.enabledEdit=true;t.clickToEdit=false;t.detail={height:"auto",onShowDetail:function(i,r,l){$(r).addClass("l-grid-detailpanel-edit");e.beginEdit(i,function(e,i){var l=$("<div class='l-editbox'></div>");l.width(120).height(t.rowHeight+1);l.appendTo(r);return l});function a(){$(r).parent().parent().remove();e.collapseDetail(i)}$("<div class='l-clear'></div>").appendTo(r);var o=$("<button type='button'><span class='icon_save'>"+t.saveMessage+"</span></button>");o.render();o.appendTo(r).click(function(){if(e.submitEdit(i)==false)return false;e.endEdit(i);a()});var n=$("<button type='button'><span class='icon_ok'>"+t.applyMessage+"</span></button>");n.render();n.appendTo(r).click(function(){e.submitEdit(i)});var d=$("<button type='button'><span class='icon_no'>"+t.cancelMessage+"</span></button>");d.render();d.appendTo(r).click(function(){e.cancelEdit(i);a()})}}}if(t.tree){t.tree.childrenName=t.tree.childrenName||"children";t.tree.isParent=t.tree.isParent||function(e){var i;if("isParent"in e){if(e.isParent==true){i=true}else{i=false}}else if(t.tree.childrenName in e){if(null==e.children||e.children.length==0){i=false}else{i=true}}else{i=false}return i};t.tree.iconClass=t.tree.iconClass||function(e){var t="";if("iconClass"in e){if(e.iconClass!=""){t=e.iconClass}}return t};t.tree.isExtend=t.tree.isExtend||function(e){if("isextend"in e&&e["isextend"]==false)return false;return true}}},_render:function(){var e=this,t=this.options;e.grid=$(e.element);e.grid.addClass("l-panel");var i=[];i.push(" <div class='l-panel-header'><span class='l-panel-header-text'></span></div>");i.push(" <div class='l-grid-loading'></div>");i.push(" <div class='l-panel-topbar'></div>");i.push(" <div class='l-panel-bwarp'>");i.push(" <div class='l-panel-body'>");i.push(" <div class='l-grid'>");i.push(" <div class='l-grid-dragging-line'></div>");i.push(" <div class='l-grid-popup'><table cellpadding='0' cellspacing='0'><tbody></tbody></table></div>");i.push(" <div class='l-grid1'>");if(t.multihead){i.push(" <div class='l-grid-header l-grid-header-multi'>")}else{i.push(" <div class='l-grid-header l-grid-header1'>")}i.push(" <div class='l-grid-header-inner'><table class='l-grid-header-table' cellpadding='0' cellspacing='0'><tbody></tbody></table></div>");i.push(" </div>");i.push(" <div class='l-grid-body l-grid-body1'>");i.push(" </div>");i.push(" </div>");i.push(" <div class='l-grid2'>");if(t.multihead){i.push(" <div class='l-grid-header l-grid-header-multi'>")}else{i.push(" <div class='l-grid-header l-grid-header2'>")}i.push(" <div class='l-grid-header-inner'><table class='l-grid-header-table' cellpadding='0' cellspacing='0'><tbody></tbody></table></div>");i.push(" </div>");i.push(" <div class='l-grid-body l-grid-body2 l-scroll'>");i.push(" </div>");i.push(" </div>");i.push(" </div>");i.push(" </div>");i.push(" </div>");i.push(" <div class='l-panel-bar'>");i.push(" <div class='l-panel-bbar-inner'>");if(t.showPageInfo){i.push(" <div class='l-bar-group l-bar-message'><span class='l-bar-text'></span></div>")}else{i.push(" <div class='l-bar-group l-bar-message' style='display:none;'><span class='l-bar-text'></span></div>")}if(t.showPageSize){i.push(" <div class='l-bar-group l-bar-selectpagesize'></div>");i.push(" <div class='l-bar-separator'></div>")}else{i.push(" <div class='l-bar-group l-bar-selectpagesize' style='display:none;'></div>");i.push(" <div class='l-bar-separator' style='display:none;'></div>")}i.push(" <div class='l-bar-group'>");i.push(" <div class='l-bar-button l-bar-btnfirst'><span></span></div>");i.push(" <div class='l-bar-button l-bar-btnprev'><span></span></div>");i.push(" </div>");i.push(" <div class='l-bar-separator'></div>");i.push(" <div class='l-bar-group'><span class='pcontrol'> <input type='text' size='4' value='1' style='width:20px' maxlength='5' /> / <span></span></span></div>");i.push(" <div class='l-bar-separator'></div>");i.push(" <div class='l-bar-group'>");i.push(" <div class='l-bar-button l-bar-btnnext'><span></span></div>");i.push(" <div class='l-bar-button l-bar-btnlast'><span></span></div>");i.push(" </div>");i.push(" <div class='l-bar-separator'></div>");i.push(" <div class='l-bar-group'>");i.push(" <div class='l-bar-button l-bar-btnload'><span></span></div>");i.push(" </div>");if(t.showPageInfo){i.push(" <div class='l-bar-separator'></div>")}else{i.push(" <div class='l-bar-separator' style='display:none;'></div>")}i.push(" <div class='l-clear'></div>");i.push(" </div>");i.push(" </div>");e.grid.html(i.join(""));e.header=$(".l-panel-header:first",e.grid);e.body=$(".l-panel-body:first",e.grid);e.toolbar=$(".l-panel-bar:first",e.grid);e.popup=$(".l-grid-popup:first",e.grid);e.gridloading=$(".l-grid-loading:first",e.grid);e.draggingline=$(".l-grid-dragging-line",e.grid);e.topbar=$(".l-panel-topbar:first",e.grid);e.gridview=$(".l-grid:first",e.grid);e.gridview.attr("id",e.id+"grid");e.gridview1=$(".l-grid1:first",e.gridview);e.gridview2=$(".l-grid2:first",e.gridview);e.gridheader=$(".l-grid-header:first",e.gridview2);e.gridbody=$(".l-grid-body:first",e.gridview2);e.f={};e.f.gridheader=$(".l-grid-header:first",e.gridview1);e.f.gridbody=$(".l-grid-body:first",e.gridview1);e.currentData=null;e.changedCells={};e.editors={};e.editor={editing:false};if(t.height=="auto"){e.bind("SysGridHeightChanged",function(){if(e.enabledFrozen())e.gridview.height(Math.max(e.gridview1.height(),e.gridview2.height()))})}var r=$.extend({},t);this._bulid();this._setColumns(t.columns);delete r["columns"];delete r["data"];delete r["url"];e.set(r);if(!t.delayLoad){if(t.url)e.set({url:t.url});else if(t.data)e.set({data:t.data})}},_setFrozen:function(e){if(e)this.grid.addClass("l-frozen");else this.grid.removeClass("l-frozen")},_setCssClass:function(e){this.grid.addClass(e)},_setLoadingMessage:function(e){this.gridloading.html(e)},_setHeight:function(e){var t=this,i=this.options;t.unbind("SysGridHeightChanged");if(e=="auto"){t.bind("SysGridHeightChanged",function(){if(t.enabledFrozen())t.gridview.height(Math.max(t.gridview1.height(),t.gridview2.height()))});return}if(typeof e=="string"&&e.indexOf("%")>0){if(i.inWindow)e=$(window).height()*parseFloat(e)*.01;else e=t.grid.parent().height()*parseFloat(e)*.01}if(i.title)e-=24;if(i.usePager)e-=32;if(i.totalRender)e-=25;if(i.toolbar)e-=t.topbar.outerHeight();var r=i.headerRowHeight*(t._columnMaxLevel-1)+i.headerRowHeight-1;e-=r;if(e>0){t.gridbody.height(e);if(e>18)t.f.gridbody.height(e-18);t.gridview.height(e+r)}},_updateFrozenWidth:function(){var e=this,t=this.options;if(e.enabledFrozen()){e.gridview1.width(e.f.gridtablewidth);var i=e.gridview.width()-e.f.gridtablewidth;e.gridview2.css({left:e.f.gridtablewidth});if(i>0)e.gridview2.css({width:i})}},_setWidth:function(e){var t=this,i=this.options;if(t.enabledFrozen())t._onResize()},_setUrl:function(e){this.options.url=e;if(e){this.options.dataType="server";this.loadData(true)}else{this.options.dataType="local"}},_setData:function(e){this.loadData(this.options.data)},loadData:function(e,t){var i=this,r=this.options;i.loading=true;var l=null;var a=true;if(getTypeFlage()!="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){return}if(typeof e=="function"){l=e;a=false}else if(typeof e=="boolean"){a=e}else if(typeof e=="object"&&e){a=false;r.dataType="local";r.data=e}if(!r.newPage)r.newPage=1;if(r.dataAction=="server"){if(!r.sortOrder)r.sortOrder="desc"}var o=[];if(r.params){if(r.params.length){$(r.params).each(function(){o.push({name:this.name,value:this.value})})}else if(typeof r.params=="object"){for(var n in r.params){o.push({name:n,value:r.params[n]})}}}if(r.dataAction=="server"){if(r.usePager){o.push({name:r.pageParmName,value:r.newPage});o.push({name:r.pagesizeParmName,value:r.pageSize})}if(r.sortName){o.push({name:r.sortnameParmName,value:r.sortName});o.push({name:r.sortorderParmName,value:r.sortOrder})}}$(".l-bar-btnload span",i.toolbar).addClass("l-disabled");$(".l-grid-hd-row").removeClass("l-checked");if(r.dataType=="local"){i.filteredData=i.data=r.data;if(l)i.filteredData[r.root]=i._searchData(i.filteredData[r.root],l);if(r.usePager)i.currentData=i._getCurrentPageData(i.filteredData);else{i.currentData=i.filteredData}i._showData()}else if(r.dataAction=="local"&&!a){if(i.data&&i.data[r.root]){i.filteredData=i.data;if(l)i.filteredData[r.root]=i._searchData(i.filteredData[r.root],l);i.currentData=i._getCurrentPageData(i.filteredData);i._showData()}}else{i.loadServerData(o,l)}i.detailExtendRow=i.detailExtendRow||[];if(i.detailExtendRow.length>0){for(var d=0;d<i.detailExtendRow.length;d++){var s=i.detailExtendRow[d];i.extendDetail(s)}i.trigger("SysGridHeightChanged")}if(t==true&&r.detail){i.bind("afterShowData",function(){i.detailExtendRow=i.detailExtendRow||[];if(i.detailExtendRow.length>0){for(var e=0;e<i.detailExtendRow.length;e++){var t=i.detailExtendRow[e];i.extendDetail(t)}i.trigger("SysGridHeightChanged")}})}else if(t==false&&r.detail){i.detailExtendRow=i.detailExtendRow||[];if(i.detailExtendRow.length>0){for(var d=0;d<i.detailExtendRow.length;d++){var s=i.detailExtendRow[d];i.collapseDetail(s)}i.trigger("SysGridHeightChanged")}i.detailExtendRow=[]}i.loading=false},loadServerData:function(e,t){var i=this,r=this.options;var l={type:r.method,url:r.url,data:e,async:r.async,dataType:"json",beforeSend:function(){if(i.hasBind("loading")){i.trigger("loading")}else{i.toggleLoading(true)}},success:function(e){i.trigger("success",[e,i]);if(!e||!e[r.root]||!e[r.root].length){i.currentData=i.data={};i.currentData[r.root]=i.data[r.root]=[];i.currentData[r.record]=i.data[r.record]=0;i._showData();return}i.data=e;if(r.dataAction=="server"){i.currentData=i.data}else{i.filteredData=i.data;if(t)i.filteredData[r.root]=i._searchData(i.filteredData[r.root],t);if(r.usePager)i.currentData=i._getCurrentPageData(i.filteredData);else i.currentData=i.filteredData}i._showData.quiDefer(i,10,[i.currentData])},complete:function(){i.trigger("complete",[i]);if(i.hasBind("loaded")){i.trigger("loaded",[i])}else{i.toggleLoading.quiDefer(i,10,[false])}},error:function(e,t,l){i.currentData=i.data={};i.currentData[r.root]=i.data[r.root]=[];i.currentData[r.record]=i.data[r.record]=0;i.toggleLoading.quiDefer(i,10,[false]);$(".l-bar-btnload span",i.toolbar).removeClass("l-disabled");i.trigger("error",[e,t,l])}};if(r.contentType)l.contentType=r.contentType;$.ajax(l)},toggleLoading:function(e){this.gridloading[e?"show":"hide"]()},setNewPage:function(e){var t=this,i=this.options;i.newPage=e},getParams:function(){var e=this,t=this.options;return t.params},_createEditor:function(e,t,i,r,l){var a=this,o=this.options;var n=e.create(t,i,a,o,i.value);if(e.setValue)e.setValue(n,i.value,i,a,o);if(e.resize)e.resize(n,r,l,i);return n},beginEdit:function(e,t){var i=this,r=this.options;if(!r.enabledEdit||r.clickToEdit)return;var l=i.getRow(e);if(l._editing)return;if(i.trigger("beginEdit",{record:l,rowindex:l["__index"]})==false)return;i.editors[l["__id"]]={};l._editing=true;i.reRender({rowdata:l});t=t||function(e,t){var r=i.getCellObj(e,t);var l=$(r).html("");i.setCellEditing(e,t,true);return l};for(var a=0,o=i.columns.length;a<o;a++){var n=i.columns[a];if(!n.name||!n.editor||!n.editor.type||!r.editors[n.editor.type])continue;var d=r.editors[n.editor.type];var s={record:l,value:l[n.name],column:n,rowindex:l["__index"],grid:i};var u=t(l,n);var c=u.width(),h=u.height();var f=i._createEditor(d,u,s,c,h);i.editors[l["__id"]][n["__id"]]={editor:d,input:f,editParm:s,container:u}}i.trigger("afterBeginEdit",{record:l,rowindex:l["__index"]})},cancelEdit:function(e){var t=this;if(e==undefined){for(var i in t.editors){t.cancelEdit(i)}}else{var r=t.getRow(e);if(!t.editors[r["__id"]])return;if(t.trigger("cancelEdit",{record:r,rowindex:r["__index"]})==false)return;for(var l in t.editors[r["__id"]]){var a=t.editors[r["__id"]][l];if(a.editor.destroy)a.editor.destroy(a.input,a.editParm)}delete t.editors[r["__id"]];delete r["_editing"];t.reRender({rowdata:r})}},addEditRow:function(e,t,i){var r=this,l=this.options;if(t&&t["_editing"])delete t["_editing"];r.endEdit();e=this.add(e,t,i);this.beginEdit(e)},submitEdit:function(e){var t=this,i=this.options;if(e==undefined){for(var r in t.editors){t.submitEdit(r)}}else{var l=t.getRow(e);var a={};if(!t.editors[l["__id"]])return;for(var o in t.editors[l["__id"]]){var n=t.editors[l["__id"]][o];var d=n.editParm.column;if(d.name)a[d.name]=n.editor.getValue(n.input,n.editParm)}if(t.trigger("beforeSubmitEdit",{record:l,rowindex:l["__index"],newdata:a})==false)return false;t.updateRow(l,a);t.trigger("afterSubmitEdit",{record:l,rowindex:l["__index"],newdata:a})}},endEdit:function(e){var t=this,i=this.options;if(t.editor.editing){var r=t.editor;if(t.trigger("sysEndEdit",[t.editor.editParm])==false){return false}t.trigger("sysEndEdit",[t.editor.editParm]);t.trigger("endEdit",[t.editor.editParm]);if(r.editor.destroy)r.editor.destroy(r.input,r.editParm);t.editor.container.remove();t.reRender({rowdata:t.editor.editParm.record,column:t.editor.editParm.column});t.trigger("afterEdit",[t.editor.editParm]);t.editor={editing:false}}else if(e!=undefined){var l=t.getRow(e);if(!t.editors[l["__id"]])return;if(t.submitEdit(e)==false)return false;for(var a in t.editors[l["__id"]]){var r=t.editors[l["__id"]][a];if(r.editor.destroy)r.editor.destroy(r.input,r.editParm)}delete t.editors[l["__id"]];delete l["_editing"];t.trigger("afterEdit",{record:l,rowindex:l["__index"]})}else{for(var o in t.editors){t.endEdit(o)}}},setWidth:function(e){return this._setWidth(e)},setHeight:function(e){return this._setHeight(e)},enabledCheckbox:function(){return this.options.checkbox?true:false},enabledFrozen:function(){var e=this,t=this.options;if(!t.frozen)return false;var i=e.columns||[];if(e.enabledDetail()&&t.frozenDetail||e.enabledCheckbox()&&t.frozenCheckbox||t.frozenRownumbers&&t.rownumbers)return true;for(var r=0,l=i.length;r<l;r++){if(i[r].frozen){return true}}this._setFrozen(false);return false},enabledDetailEdit:function(){if(!this.enabledDetail())return false;return this.options.detailToEdit?true:false},enabledDetail:function(){if(this.options.detail&&this.options.detail.onShowDetail)return true;return false},enabledGroup:function(){return this.options.groupColumnName?true:false},deleteSelectedRow:function(){if(!this.selected)return;for(var e in this.selected){var t=this.selected[e];if(t["__id"]in this.records)this._deleteData.quiDefer(this,10,[t])}this.reRender.quiDefer(this,20)},removeRange:function(e){var t=this,i=this.options;$.each(e,function(){t._removeData(this)});t.reRender()},remove:function(e){var t=this,i=this.options;var r=t.getRow(e);t._removeData(e);t.reRender()},deleteRange:function(e){var t=this,i=this.options;$.each(e,function(){t._deleteData(this)});t.reRender()},deleteRow:function(e){var t=this,i=this.options;var r=t.getRow(e);if(!r)return;t._deleteData(r);t.reRender();t.isDataChanged=true},_deleteData:function(e){var t=this,i=this.options;var r=t.getRow(e);r[i.statusName]="delete";if(i.tree){var l=t.getChildren(r,true);if(l){for(var a=0,o=l.length;a<o;a++){l[a][i.statusName]="delete"}}}t.deletedRows=t.deletedRows||[];t.deletedRows.push(r);t._removeSelected(r)},updateCell:function(e,t,i){var r=this,l=this.options;var a,o,n;if(typeof e=="string"){for(var d=0,s=r.columns.length;d<s;d++){if(r.columns[d].name==e){r.updateCell(d,t,i)}}return}if(typeof e=="number"){a=r.columns[e];n=r.getRow(i);o=r.getCellObj(n,a)}else if(typeof e=="object"&&e["__id"]){a=e;n=r.getRow(i);o=r.getCellObj(n,a)}else{o=e;var u=o.id.split("|");var c=u[u.length-1];a=r._columns[c];var h=$(o).parent();n=n||r.getRow(h[0])}if(t!=null&&a.name){n[a.name]=t;if(n[l.statusName]!="add")n[l.statusName]="update";r.isDataChanged=true}r.reRender({rowdata:n,column:a})},addRows:function(e,t,i,r){var l=this,a=this.options;$(e).each(function(){l.addRow(this,t,i,r)})},_createRowid:function(){return"r"+(1e3+this.recordNumber)},_isRowId:function(e){return e in this.records},_addNewRecord:function(e,t,i){var r=this,l=this.options;r.recordNumber++;e["__id"]=r._createRowid();e["__previd"]=t;if(t&&t!=-1){var a=r.records[t];if(a["__nextid"]&&a["__nextid"]!=-1){var o=r.records[a["__nextid"]];if(o)o["__previd"]=e["__id"]}a["__nextid"]=e["__id"];e["__index"]=a["__index"]+1}else{e["__index"]=0}if(l.tree){if(i&&i!=-1){var n=r.records[i];e["__pid"]=i;e["__level"]=n["__level"]+1}else{e["__pid"]=-1;e["__level"]=1}e["__hasChildren"]=e[l.tree.childrenName]?true:false}if(e[l.statusName]!="add")e[l.statusName]="nochanged";r.rows[e["__index"]]=e;r.records[e["__id"]]=e;return e},_getRows:function(e){var t=this,i=this.options;var r=[];function l(e){if(!e||!e.length)return;for(var t=0,a=e.length;t<a;t++){var o=e[t];r.push(o);if(o[i.tree.childrenName]){l(o[i.tree.childrenName])}}}l(e);return r},_updateGridData:function(){var e=this,t=this.options;e.recordNumber=0;e.rows=[];e.records={};var i=-1;function r(l,a){if(!l||!l.length)return;for(var o=0,n=l.length;o<n;o++){var d=l[o];e.formatRecord(d);if(d[t.statusName]=="delete")continue;e._addNewRecord(d,i,a);i=d["__id"];if(d["__hasChildren"]){r(d[t.tree.childrenName],d["__id"])}}}r(e.currentData[t.root],-1);return e.rows},_moveData:function(e,t,i){var r=this,l=this.options;var a=r.getRow(e);var o=r.getRow(t);var n,d;var s=r._getParentChildren(a);n=$.inArray(a,s);s.splice(n,1);s=r._getParentChildren(o);d=$.inArray(o,s);s.splice(d+(i?1:0),0,a)},move:function(e,t,i){this._moveData(e,t,i);this.reRender()},moveRange:function(e,t,i){for(var r in e){this._moveData(e[r],t,i)}this.reRender()},up:function(e){var t=this,i=this.options;var r=t.getRow(e);var l=t._getParentChildren(r);var a=$.inArray(r,l);if(a==-1||a==0)return;var o=t.getSelected();t.move(r,l[a-1],false);if(o){t.select(o)}},down:function(e){var t=this,i=this.options;var r=t.getRow(e);var l=t._getParentChildren(r);var a=$.inArray(r,l);if(a==-1||a==l.length-1)return;var o=t.getSelected();t.move(r,l[a+1],true);if(o){t.select(o)}},addRow:function(e,t,i,r){var l=this,a=this.options;e=e||{};l._addData(e,r,t,i);l.reRender();e[a.statusName]="add";if(a.tree){var o=l.getChildren(e,true);if(o){for(var n=0,d=o.length;n<d;n++){o[n][a.statusName]="add"}}}l.isDataChanged=true;a.total=a.total?a.total+1:1;a.pageCount=Math.ceil(a.total/a.pageSize);l._buildPager();l.trigger("SysGridHeightChanged");l.trigger("afterAddRow",[e]);return e},updateRow:function(e,t){var i=this,r=this.options;var l=i.getRow(e);i.isDataChanged=true;$.extend(l,t||{});if(l[r.statusName]!="add")l[r.statusName]="update";i.reRender.quiDefer(i,10,[{rowdata:l}]);return l},setCellEditing:function(e,t,i){var r=this,l=this.options;var a=r.getCellObj(e,t);var o=i?"addClass":"removeClass";$(a)[o]("l-grid-row-cell-editing");if(e["__id"]!=0){var n=$(r.getRowObj(e["__id"])).prev();if(!n.length)return;var d=r.getRow(n[0]);var s=r.getCellObj(d,t);if(!s)return;$(s)[o]("l-grid-row-cell-editing-topcell")}if(t["__previd"]!=-1&&t["__previd"]!=null){var s=$(r.getCellObj(e,t)).prev();$(s)[o]("l-grid-row-cell-editing-leftcell")}},reRender:function(e){var t=this,i=this.options;e=e||{};var r=e.rowdata,l=e.column;if(l&&(l.isdetail||l.ischeckbox))return;if(r&&r[i.statusName]=="delete")return;if(r&&l){var a=t.getCellObj(r,l);$(a).html(t._getCellHtml(r,l));if(!l.issystem)t.setCellEditing(r,l,false)}else if(r){$(t.columns).each(function(){t.reRender({rowdata:r,column:this})})}else if(l){for(var o in t.records){t.reRender({rowdata:t.records[o],column:l})}for(var n=0;n<t.totalNumber;n++){var d=document.getElementById(t.id+"|total"+n+"|"+l["__id"]);$("div:first",d).html(t._getTotalCellContent(l,t.groups&&t.groups[n]?t.groups[n]:t.currentData[i.root]))}}else{t._showData()}},getData:function(e,t){var i=this,r=this.options;var l=[];for(var a in i.records){var o=$.extend(true,{},i.records[a]);if(o[r.statusName]==e||e==undefined){l.push(i.formatRecord(o,t))}}return l},formatRecord:function(e,t){delete e["__id"];delete e["__previd"];delete e["__nextid"];delete e["__index"];if(this.options.tree){delete e["__pid"];delete e["__level"];delete e["__hasChildren"]}if(t)delete e[this.options.statusName];return e},getUpdated:function(){return this.getData("update",true)},getDeleted:function(){return this.deletedRows},getAdded:function(){return this.getData("add",true)},getColumn:function(e){var t=this,i=this.options;if(typeof e=="string"){if(t._isColumnId(e))return t._columns[e];else return t.columns[parseInt(e)]}else if(typeof e=="number"){return t.columns[e]}else if(typeof e=="object"&&e.nodeType==1){var r=e.id.split("|");var l=r[r.length-1];return t._columns[l]}return e},getColumnType:function(e){var t=this,r=this.options;for(i=0;i<t.columns.length;i++){if(t.columns[i].name==e){if(t.columns[i].type)return t.columns[i].type;return"string"}}return null},isTotalSummary:function(){var e=this,t=this.options;for(var i=0;i<e.columns.length;i++){if(e.columns[i].totalSummary)return true}return false},getColumns:function(e){var t=this,i=this.options;var r=[];for(var l in t._columns){var a=t._columns[l];if(e!=undefined){if(a["__level"]==e)r.push(a)}else{if(a["__leaf"])r.push(a)}}return r},changeSort:function(e,t){var i=this,r=this.options;if(i.loading)return true;if(r.dataAction=="local"){var l=i.getColumnType(e);if(!i.sortedData)i.sortedData=i.filteredData;if(r.sortName==e){i.sortedData[r.root].reverse()}else{i.sortedData[r.root].sort(function(t,r){return i._compareData(t,r,e,l)})}if(r.usePager)i.currentData=i._getCurrentPageData(i.sortedData);else i.currentData=i.sortedData;i._showData()}r.sortName=e;r.sortOrder=t;if(r.dataAction=="server"){i.loadData(r.where)}i.trigger("changeSort")},changePage:function(e){var t=this,i=this.options;if(t.loading)return true;i.pageCount=parseInt($(".pcontrol span",t.toolbar).html());switch(e){case"first":if(i.page==1)return;i.newPage=1;break;case"prev":if(i.page==1)return;if(i.page>1)i.newPage=parseInt(i.page)-1;break;case"next":if(i.page>=i.pageCount)return;i.newPage=parseInt(i.page)+1;break;case"last":if(i.page>=i.pageCount)return;i.newPage=i.pageCount;break;case"input":var r=parseInt($(".pcontrol input",t.toolbar).val());if(isNaN(r))r=1;if(r<1)r=1;else if(r>i.pageCount)r=i.pageCount;$(".pcontrol input",t.toolbar).val(r);i.newPage=r;break}if(i.newPage==i.page)return false;if(i.newPage==1){$(".l-bar-btnfirst span",t.toolbar).addClass("l-disabled");$(".l-bar-btnprev span",t.toolbar).addClass("l-disabled")}else{$(".l-bar-btnfirst span",t.toolbar).removeClass("l-disabled");$(".l-bar-btnprev span",t.toolbar).removeClass("l-disabled")}if(i.newPage==i.pageCount){$(".l-bar-btnlast span",t.toolbar).addClass("l-disabled");$(".l-bar-btnnext span",t.toolbar).addClass("l-disabled")}else{$(".l-bar-btnlast span",t.toolbar).removeClass("l-disabled");$(".l-bar-btnnext span",t.toolbar).removeClass("l-disabled")}t.trigger("changePage",[i.newPage]);if(i.dataAction=="server"){t.loadData(i.where)}else{t.currentData=t._getCurrentPageData(t.filteredData);t._showData()}},getSelectedRow:function(){for(var e in this.selected){var t=this.selected[e];if(t["__id"]in this.records)return t}return null},getSelectedRows:function(){var e=[];for(var t in this.selected){var i=this.selected[t];if(i["__id"]in this.records)e.push(i)}return e},getSelectedRowObj:function(){for(var e in this.selected){var t=this.selected[e];if(t["__id"]in this.records)return this.getRowObj(t)}return null},getSelectedRowObjs:function(){var e=[];for(var t in this.selected){var i=this.selected[t];if(i["__id"]in this.records)e.push(this.getRowObj(i))}return e},getCellObj:function(e,t){var i=this.getRow(e);t=this.getColumn(t);if(i==null){ return null; }return document.getElementById(this._getCellDomId(i,t))},getRowObj:function(e,t){var i=this,r=this.options;if(e==null)return null;if(typeof e=="string"){if(i._isRowId(e))return document.getElementById(i.id+(t?"|1|":"|2|")+e);else return document.getElementById(i.id+(t?"|1|":"|2|")+i.rows[parseInt(e)]["__id"])}else if(typeof e=="number"){return document.getElementById(i.id+(t?"|1|":"|2|")+i.rows[e]["__id"])}else if(typeof e=="object"&&e["__id"]){return i.getRowObj(e["__id"],t)}return e},getRow:function(e){var t=this,i=this.options;if(e==null)return null;if(typeof e=="string"){if(t._isRowId(e))return t.records[e];else return t.rows[parseInt(e)]}else if(typeof e=="number"){return t.rows[parseInt(e)]}else if(typeof e=="object"&&e.nodeType==1&&!e["__id"]){return t._getRowByDomId(e.id)}return e},_setColumnVisible:function(e,t){var i=this,r=this.options;if(!t){e._hide=false;document.getElementById(e["__domid"]).style.display="";if(e["__pid"]!=-1){var l=i._columns[e["__pid"]];if(l._hide){document.getElementById(l["__domid"]).style.display="";this._setColumnVisible(l,t)}}}else{e._hide=true;document.getElementById(e["__domid"]).style.display="none";if(e["__pid"]!=-1){var a=true;var l=this._columns[e["__pid"]];for(var o=0;l&&o<l.columns.length;o++){if(!l.columns[o]._hide){a=false;break}}if(a){l._hide=true;document.getElementById(l["__domid"]).style.display="none";this._setColumnVisible(l,t)}}}},toggleCol:function(e,t,i){var r=this,l=this.options;var a;if(typeof e=="number"){a=r.columns[e]}else if(typeof e=="object"&&e["__id"]){a=e}else if(typeof e=="string"){if(r._isColumnId(e)){a=r._columns[e]}else{$(r.columns).each(function(){if(this.name==e)r.toggleCol(this,t,i)});return}}if(!a)return;var o=a["__leafindex"];var n=document.getElementById(a["__domid"]);if(!n)return;n=$(n);var d=[];for(var s in r.rows){var u=r.getCellObj(r.rows[s],a);if(u)d.push(u)}for(var s=0;s<r.totalNumber;s++){var c=document.getElementById(r.id+"|total"+s+"|"+a["__id"]);if(c)d.push(c)}var h=a._width;if(t&&a._hide){if(a.frozen)r.f.gridtablewidth+=parseInt(h)+1;else r.gridtablewidth+=parseInt(h)+1;r._setColumnVisible(a,false);$(d).show()}else if(!t&&!a._hide){if(a.frozen)r.f.gridtablewidth-=parseInt(h)+1;else r.gridtablewidth-=parseInt(h)+1;r._setColumnVisible(a,true);$(d).hide()}if(a.frozen){$("div:first",r.f.gridheader).width(r.f.gridtablewidth);$("div:first",r.f.gridbody).width(r.f.gridtablewidth)}else{$("div:first",r.gridheader).width(r.gridtablewidth+40);$("div:first",r.gridbody).width(r.gridtablewidth)}r._updateFrozenWidth();if(!i){$(":checkbox[columnindex="+o+"]",r.popup).each(function(){this.checked=t;if($.fn.quiCheckBox){var e=$(this).quiGetCheckBoxManager();if(e)e.updateStyle()}})}},setColumnWidth:function(e,t){var i=this,r=this.options;if(!t)return;t=parseInt(t,10);var l;if(typeof e=="number"){l=i.columns[e]}else if(typeof e=="object"&&e["__id"]){l=e}else if(typeof e=="string"){if(i._isColumnId(e)){l=i._columns[e]}else{$(i.columns).each(function(){if(this.name==e)i.setColumnWidth(this,t)});return}}if(!l)return;var a=r.minColumnWidth;if(l.minWidth)a=l.minWidth;t=t<a?a:t;var o=t-l._width;if(i.trigger("beforeChangeColumnWidth",[l,t])==false)return;l._width=t;if(l.frozen){i.f.gridtablewidth+=o;$("div:first",i.f.gridheader).width(i.f.gridtablewidth);$("div:first",i.f.gridbody).width(i.f.gridtablewidth)}else{i.gridtablewidth+=o;$("div:first",i.gridheader).width(i.gridtablewidth+40);$("div:first",i.gridbody).width(i.gridtablewidth)}$(document.getElementById(l["__domid"])).css("width",t);var n=[];for(var d in i.records){var s=i.getCellObj(i.records[d],l);if(s)n.push(s);if(!i.enabledDetailEdit()&&i.editors[d]&&i.editors[d][l["__id"]]){var u=i.editors[d][l["__id"]];if(u.editor.resize)u.editor.resize(u.input,t,u.container.height(),u.editParm)}}for(var c=0;c<i.totalNumber;c++){var h=document.getElementById(i.id+"|total"+c+"|"+l["__id"]);if(h)n.push(h)}$(n).css("width",t).find("> div.l-grid-row-cell-inner:first").css("width",t-8);i._updateFrozenWidth();i.trigger("afterChangeColumnWidth",[l,t])},changeHeaderText:function(e,t){var i=this,r=this.options;var l;if(typeof e=="number"){l=i.columns[e]}else if(typeof e=="object"&&e["__id"]){l=e}else if(typeof e=="string"){if(i._isColumnId(e)){l=i._columns[e]}else{$(i.columns).each(function(){if(this.name==e)i.changeHeaderText(this,t)});return}}if(!l)return;var a=l["__leafindex"];var o=document.getElementById(l["__domid"]);$(".l-grid-hd-cell-text",o).html(t);if(r.allowHideColumn){$(":checkbox[columnindex="+a+"]",i.popup).parent().next().html(t)}},changeCol:function(e,t,i){var r=this,l=this.options;if(!e||!t)return;var a=r.getColumn(e);var o=r.getColumn(t);a.frozen=o.frozen;var n,d;var s=a["__pid"]==-1?l.columns:r._columns[a["__pid"]].columns;var u=o["__pid"]==-1?l.columns:r._columns[o["__pid"]].columns;n=$.inArray(a,s);d=$.inArray(o,u);var c=s==u;var h=a["__level"]==o["__level"];u.splice(d+(i?1:0),0,a);if(!c){s.splice(n,1)}else{if(i)s.splice(n,1);else s.splice(n+1,1)}r._setColumns(l.columns);r.reRender()},resetHeight:function(){var e=this,t=this.options;if(t.height&&t.height!="auto"){var i=$(window).height();var r=0;var l=null;if(typeof t.height=="string"&&t.height.indexOf("%")>0){var a=e.grid.parent();if(t.InWindow){l=i;l-=parseInt($("body").css("paddingTop"));l-=parseInt($("body").css("paddingBottom"))}else{
  3. l=a.height()}r=l*parseFloat(t.height)*.01;if(t.InWindow||a[0].tagName.toLowerCase()=="body")r-=e.grid.offset().top-parseInt($("body").css("paddingTop"))}else{r=parseInt(t.height)}r+=t.heightDiff;e.windowHeight=i;e._setHeight(r)}},resetWidth:function(){var e=this,t=this.options;if(e.enabledFrozen()){var i=e.gridview1.width();var r=e.gridview.width();e.gridview2.css({width:r-i})}if(t.percentWidthMode==true){if(t.detail){}else{if(t.oldTotalWidth!=e.grid.width()){var l=0;var a=0;if(t.rownumbers){l=t.rownumbersColWidth+2}if(t.checkbox){a=t.checkboxColWidth+3}e.gridtablewidth=e.grid.width()-l-a;if(e.columns){e.gridtablewidth=e.gridtablewidth}var o;if($(e.columns).length>0){o=e.grid.width()-e.columns.length-l-a}$(e.columns).each(function(e,t){if(t.isrownumber){}else if(t.ischeckbox){}else if(t.isdetail){}else{if(t.width){if(typeof t.width=="number"){o=o-t.width}}}});$(e.columns).each(function(t,i){if(i.isrownumber){}else if(i.ischeckbox){}else if(i.isdetail){}else{var r;if(i.width){r=i.width;if(typeof r=="string"&&r.indexOf("%")>0){i._width=r=parseInt(parseInt(r)*.01*o);e.setColumnWidth(i,i._width)}}}});t.oldTotalWidth=e.grid.width()}}}},setScroller:function(e,t,i){var r=this,l=this.options;var a;var o;if(e&&typeof e=="string"){if(e=="bottom"){a=r.gridbody.find(".l-grid-body-inner").height()}else if(e=="top"){a=0}}else if(e&&typeof e=="number"){a=e}if(t&&typeof t=="string"){if(t=="right"){o=r.gridbody.find(".l-grid-body-inner").width()}else if(t=="left"){o=0}}else if(t&&typeof t=="number"){o=t}if(t!=null&&e!=null){if(i==true){r.gridbody.animate({scrollTop:a,scrollLeft:o},1e3)}else{r.gridbody[0].scrollTop=a;r.gridbody[0].scrollLeft=o}}else if(t==null){if(i==true){r.gridbody.animate({scrollTop:a},1e3)}else{r.gridbody[0].scrollTop=a}}else if(e==null){if(i==true){r.gridbody.animate({scrollLeft:o},1e3)}else{r.gridbody[0].scrollLeft=o}}},collapseDetail:function(e){var t=this,i=this.options;var r=t.getRow(e);if(!r)return;for(var l=0,a=t.columns.length;l<a;l++){if(t.columns[l].isdetail){var o=t.getRowObj(r);var n=t.getCellObj(r,t.columns[l]);$(o).next("tr.l-grid-detailpanel").hide();$(".l-grid-row-cell-detailbtn:first",n).removeClass("l-open");t.detailExtendRow=t.detailExtendRow||[];var d;d=$.inArray(r,t.detailExtendRow);if(d!=-1){t.detailExtendRow.splice(d,1)}t.trigger("SysGridHeightChanged");return}}},extendDetail:function(e){var t=this,i=this.options;var r=t.getRow(e);if(!r)return;for(var l=0,a=t.columns.length;l<a;l++){if(t.columns[l].isdetail){var o=$([t.getRowObj(r,false)]);var n=t.getCellObj(r,t.columns[l]);$(".l-grid-row-cell-detailbtn:first",n).addClass("l-open");t.detailExtendRow=t.detailExtendRow||[];var d;d=$.inArray(r,t.detailExtendRow);if(d==-1)t.detailExtendRow.push(r);var s=o.next("tr.l-grid-detailpanel");if(s.length>0){s.show();if(i.detail.onExtend)i.detail.onExtend(r,$(".l-grid-detailpanel-inner:first",s)[0]);if(d==-1)t.detailExtendRow.push(r);t.trigger("SysGridHeightChanged");return}if(t.enabledFrozen())o=o.add(t.getRowObj(r,true));var u=r["__id"];var c=0;for(var l=0;l<t.columns.length;l++)if(t.columns[l].frozen)c++;var h=$("<tr class='l-grid-detailpanel'><td><div class='l-grid-detailpanel-inner' style='display:none'></div></td></tr>");var f=$("<tr class='l-grid-detailpanel'><td><div class='l-grid-detailpanel-inner' style='display:none'></div></td></tr>");h.attr("id",t.id+"|detail|"+u);t.detailrows=t.detailrows||[];t.detailrows.push(h[0]);t.detailrows.push(f[0]);var g=$("div:first",h);g.parent().attr("colSpan",t.columns.length-c);o.eq(0).after(h);if(c>0){f.find("td:first").attr("colSpan",c);o.eq(1).after(f)}if(i.detail.onShowDetail){i.detail.onShowDetail(r,g[0],function(){t.trigger("SysGridHeightChanged")});$("div:first",f).add(g).show().height(i.detail.height||i.detailHeight)}else if(i.detail.render){g.append(i.detail.render());g.show()}}}t.unbind("afterShowData")},getParent:function(e){var t=this,i=this.options;if(!i.tree)return null;var r=t.getRow(e);if(!r)return null;if(r["__pid"]in t.records)return t.records[r["__pid"]];else return null},getChildren:function(e,t){var i=this,r=this.options;if(!r.tree)return null;var l=i.getRow(e);if(!l)return null;var a=[];function o(e){if(e[r.tree.childrenName]){for(var i=0,l=e[r.tree.childrenName].length;i<l;i++){var n=e[r.tree.childrenName][i];if(n["__status"]=="delete")continue;a.push(n);if(t)o(n)}}}o(l);return a},isLeaf:function(e){var t=this,i=this.options;var r=t.getRow(e);if(!r)return;return r["__hasChildren"]?false:true},hasChildren:function(e){var t=this,i=this.options;var r=this.getRow(e);if(!r)return;return r[i.tree.childrenName]&&r[i.tree.childrenName].length?true:false},existRecord:function(e){for(var t in this.records){if(this.records[t]==e)return true}return false},_removeSelected:function(e){var t=this,i=this.options;if(i.tree){var r=t.getChildren(e,true);if(r){for(var l=0,a=r.length;l<a;l++){var o=$.inArray(r[l],t.selected);if(o!=-1)t.selected.splice(o,1)}}}var n=$.inArray(e,t.selected);if(n!=-1)t.selected.splice(n,1)},_getParentChildren:function(e){var t=this,i=this.options;var r=t.getRow(e);var l;if(i.tree&&t.existRecord(r)&&r["__pid"]in t.records){l=t.records[r["__pid"]][i.tree.childrenName]}else{l=t.currentData[i.root]}return l},_removeData:function(e){var t=this,i=this.options;var r=t._getParentChildren(e);var l=$.inArray(e,r);if(l!=-1){r.splice(l,1)}t._removeSelected(e)},_addData:function(e,t,i,r){var l=this,a=this.options;var o=l.currentData[a.root];if(i){if(a.tree){if(t)o=t[a.tree.childrenName];else if(i["__pid"]in l.records)o=l.records[i["__pid"]][a.tree.childrenName]}var n=$.inArray(i,o);o.splice(n==-1?-1:n+(r?0:1),0,e)}else{if(a.tree&&t){o=t[a.tree.childrenName]}o.push(e)}},_appendData:function(e,t,i,r){var l=this,a=this.options;e[a.statusName]="update";l._removeData(e);l._addData(e,t,i,r)},appendRange:function(e,t,i,r){var l=this,a=this.options;var o=false;$.each(e,function(e,a){if(a["__id"]&&l.existRecord(a)){if(l.isLeaf(t))l.upgrade(t);l._appendData(a,t,i,r);o=true}else{l.appendRow(a,t,i,r)}});if(o)l.reRender()},appendRow:function(e,t,i,r){var l=this,a=this.options;if($.isArray(e)){l.appendRange(e,t,i,r);return}if(e["__id"]&&l.existRecord(e)){l._appendData(e,t,i,r);l.reRender();return}if(t&&l.isLeaf(t))l.upgrade(t);l.addRow(e,i,r?true:false,t)},upgrade:function(e){var t=this,i=this.options;var r=t.getRow(e);if(!r||!i.tree)return;r[i.tree.childrenName]=r[i.tree.childrenName]||[];r["__hasChildren"]=true;var l=[t.getRowObj(r)];if(t.enabledFrozen())l.push(t.getRowObj(r,true));$("> td > div > .l-grid-tree-space:last",l).addClass("l-grid-tree-link l-grid-tree-link-open")},demotion:function(e){var t=this,i=this.options;var r=t.getRow(e);if(!r||!i.tree)return;var l=[t.getRowObj(r)];if(t.enabledFrozen())l.push(t.getRowObj(r,true));$("> td > div > .l-grid-tree-space:last",l).removeClass("l-grid-tree-link l-grid-tree-link-open l-grid-tree-link-close");if(t.hasChildren(r)){var a=t.getChildren(r);for(var o=0,n=a.length;o<n;o++){t.deleteRow(a[o])}}r["__hasChildren"]=false},collapse:function(e){var t=this,i=this.options;var r=t.getRowObj(e);var l=$(".l-grid-tree-link",r);if(l.hasClass("l-grid-tree-link-close"))return;t.toggle(e)},expand:function(e){var t=this,i=this.options;var r=t.getRowObj(e);var l=$(".l-grid-tree-link",r);if(l.hasClass("l-grid-tree-link-open"))return;t.toggle(e)},toggle:function(e){if(!e)return;var t=this,i=this.options;var r=t.getRow(e);var l=[t.getRowObj(r)];if(t.enabledFrozen())l.push(t.getRowObj(r,true));var a=r["__level"],o;var n=$(".l-grid-tree-link:first",l);var d=true;t.collapsedRows=t.collapsedRows||[];if(n.hasClass("l-grid-tree-link-close")){n.removeClass("l-grid-tree-link-close").addClass("l-grid-tree-link-open");o=$.inArray(r,t.collapsedRows);if(o!=-1)t.collapsedRows.splice(o,1);t.trigger("extend")}else{d=false;n.addClass("l-grid-tree-link-close").removeClass("l-grid-tree-link-open");o=$.inArray(r,t.collapsedRows);if(o==-1)t.collapsedRows.push(r);t.trigger("collapse")}var s=t.getChildren(r,true);for(var u=0,c=s.length;u<c;u++){var h=s[u];var f=h["__level"];if(d){var g;if(i.treeExpandAll==false){if(f==a+1){g=$([t.getRowObj(h["__id"])]);if(t.enabledFrozen())g=g.add(t.getRowObj(h["__id"],true));g.show()}}else{g=$([t.getRowObj(h["__id"])]);if(t.enabledFrozen())g=g.add(t.getRowObj(h["__id"],true));$(".l-grid-tree-link",g).removeClass("l-grid-tree-link-close").addClass("l-grid-tree-link-open");g.show()}}else{var p=$([t.getRowObj(h["__id"])]);if(t.enabledFrozen())p=p.add(t.getRowObj(h["__id"],true));$(".l-grid-tree-link",p).removeClass("l-grid-tree-link-open").addClass("l-grid-tree-link-close");p.hide()}}},_bulid:function(){var e=this;e._clearGrid();e._initBuildHeader();e._initHeight();e._initFootbar();e._buildPager();e._setEvent()},_setColumns:function(e){var t=this;t._initColumns();t._initBuildGridHeader();t._initBuildPopup()},_initBuildHeader:function(){var e=this,t=this.options;if(t.title){$(".l-panel-header-text",e.header).html(t.title);if(t.headerImg)e.header.append("<img src='"+t.headerImg+"' />").addClass("l-panel-header-hasicon")}else{e.header.hide()}if(t.toolbar){if($.fn.quiToolBar)e.toolbarManager=e.topbar.quiToolBar(t.toolbar)}else{e.topbar.remove()}},_createColumnId:function(e){if(e.id!=null)return e.id.toString();return"c"+(100+this._columnCount)},_isColumnId:function(e){return e in this._columns},_initColumns:function(){var e=this,t=this.options;e._columns={};e._columnCount=0;e._columnLeafCount=0;e._columnMaxLevel=1;if(!t.columns)return;function i(e,t){for(var i in t){if(t[i]in e)delete e[t[i]]}}function r(t,l,a,o){i(t,["__id","__pid","__previd","__nextid","__domid","__leaf","__leafindex","__level","__colSpan","__rowSpan"]);if(l>e._columnMaxLevel)e._columnMaxLevel=l;e._columnCount++;t["__id"]=e._createColumnId(t);t["__domid"]=e.id+"|hcell|"+t["__id"];e._columns[t["__id"]]=t;if(!t.columns||!t.columns.length)t["__leafindex"]=e._columnLeafCount++;t["__level"]=l;t["__pid"]=a;t["__previd"]=o;if(!t.columns||!t.columns.length){t["__leaf"]=true;return 1}var n=0;var d=-1;for(var s=0,u=t.columns.length;s<u;s++){var c=t.columns[s];n+=r(c,l+1,t["__id"],d);d=c["__id"]}t["__leafcount"]=n;return n}var l=-1;if(t.rownumbers){var a=e.enabledGroup()?false:t.frozen&&t.frozenRownumbers;var o={isrownumber:true,issystem:true,width:t.rownumbersColWidth,frozen:a};r(o,1,-1,l);l=o["__id"]}if(e.enabledDetail()){var n=e.enabledGroup()?false:t.frozen&&t.frozenDetail;var o={isdetail:true,issystem:true,width:t.detailColWidth,frozen:n};r(o,1,-1,l);l=o["__id"]}if(e.enabledCheckbox()){var d=e.enabledGroup()?false:t.frozen&&t.frozenCheckbox;var o={ischeckbox:true,issystem:true,width:t.detailColWidth,frozen:d};r(o,1,-1,l);l=o["__id"]}for(var s=0,u=t.columns.length;s<u;s++){var o=t.columns[s];r(o,1,-1,l);l=o["__id"]}for(var c in e._columns){var o=e._columns[c];if(o["__leafcount"]>1){o["__colSpan"]=o["__leafcount"]}if(o["__leaf"]&&o["__level"]!=e._columnMaxLevel){o["__rowSpan"]=e._columnMaxLevel-o["__level"]+1}}e.columns=e.getColumns();$(e.columns).each(function(t,i){i.columnname=i.name;i.columnindex=t;i.type=i.type||"string";i.islast=t==e.columns.length-1;i.isSort=i.isSort==false?false:true;i.frozen=i.frozen?true:false;i._width=e._getColumnWidth(i);i._hide=i.hide?true:false});if(t.oldTotalWidth!=e.grid.width()){t.oldTotalWidth=e.grid.width()}},_getColumnWidth:function(e){var t=this,i=this.options;if(e.isrownumber&&e._width)return e._width;if(e.ischeckbox&&e._width)return e._width;var r;if(e.width){r=e.width}else if(i.columnWidth){r=i.columnWidth}if(!r){var l=4;if(t.enabledCheckbox())l+=i.checkboxColWidth;if(t.enabledDetail())l+=i.detailColWidth;r=parseInt((t.grid.width()-l)/t.columns.length)}if(typeof r=="string"&&r.indexOf("%")>0){var a=0;var o=0;if(i.rownumbers){a=i.rownumbersColWidth+2}if(i.checkbox){o=i.checkboxColWidth+3}e._width=r=parseInt(parseInt(r)*.01*(t.grid.width()-t.columns.length-a-o))}if(e.minWidth&&r<e.minWidth)r=e.minWidth;if(e.maxWidth&&r>e.maxWidth)r=e.maxWidth;e._width=r;return r},_createHeaderCell:function(e){var t=this,i=this.options;var r=$("<td class='l-grid-hd-cell'><div class='l-grid-hd-cell-inner'><span class='l-grid-hd-cell-text'></span></div></td>");r.attr("id",e["__domid"]);if(!e["__leaf"])r.addClass("l-grid-hd-cell-mul");if(e.columnindex==t.columns.length-1){r.addClass("l-grid-hd-cell-last")}if(e.isrownumber){r.addClass("l-grid-hd-cell-rownumbers");r.html("<div class='l-grid-hd-cell-inner' style='width:"+(e["_width"]-6)+"px'></div>")}if(e.ischeckbox){r.addClass("l-grid-hd-cell-checkbox");r.html("<div class='l-grid-hd-cell-inner' style='width:"+e["_width"]+"px'><div class='l-grid-hd-cell-con-checkbox'><span class='l-grid-hd-cell-text l-grid-hd-cell-btn-checkbox'></span></div></div>")}if(e.isdetail){r.addClass("l-grid-hd-cell-detail");r.html("<div class='l-grid-hd-cell-inner'><div class='l-grid-hd-cell-text l-grid-hd-cell-btn-detail'></div></div>")}if(e.heightAlign){$(".l-grid-hd-cell-inner:first",r).css("textAlign",e.heightAlign)}if(e["__colSpan"])r.attr("colSpan",e["__colSpan"]);if(e["__rowSpan"]){r.attr("rowSpan",e["__rowSpan"]);r.height(i.headerRowHeight*e["__rowSpan"])}else{r.height(i.headerRowHeight)}if(e["__leaf"]){r.width(e["_width"]);r.attr("columnindex",e["__leafindex"])}if(e._hide)r.hide();if(e.name)r.attr({columnname:e.name});var l="";if(e.display&&e.display!="")l=e.display;else if(e.headerRender)l=e.headerRender(e);else l="&nbsp;";function a(e,r){var l=0;for(var a=0;a<i.filterParams.length;a++){if(i.filterParams[a].name==e.name){i.filterParams[a].value=e.value;l=1}}if(l==0){i.filterParams.push(e)}t.setOptions({params:i.filterParams});t.setNewPage(1);t.loadData();r.remove()}if(e.filterable||e.filter){var o=$('<span class="img_find hand headerChangeBtn"></span>');var n=$('<span style="float:left;padding-left:20px;">'+l+"</span>");var d=$('<div style="float:left;padding-left:10px;width:20px;"></div>');d.append(o);$(".l-grid-hd-cell-text:first",r).append(n);$(".l-grid-hd-cell-text:first",r).after(d);o.click(function(){if(e.filterkey){var t=210;if(e.filter&&e.filter.width){t=e.filter.width+50}var i=-20;if(e.filter&&e.filter.tipDistanceX){i=e.filter.tipDistanceX}var r=0;if(e.filter&&e.filter.tipArrowDistanceX){r=e.filter.tipArrowDistanceX}var l=$(this).tip({content:"",showCloseBtn:true,width:t,distanceX:i,arrowDistanceX:r});var o=$(this).attr("tipId");var n=$("#"+o).find(".qui-tip-con");var d=e.filterkey;var s=$('<span class="img_find hand" title="过滤"></span>');var u=$('<span class="img_reload hand" title="还原"></span>');n.empty();if(e.filter&&e.filter.type=="select"){var c=$("<select></select>");if(e.filter.data){c.data("data",e.filter.data)}else if(e.filter.url){c.attr("url",e.filter.url)}if(e.filter.hidePrompt){}else{c.attr("prompt",quiLangage.quiGrid.editorPromptMessage)}if(e.filter.width){c.attr("selWidth",e.filter.width)}if(e.filter.boxWidth){c.attr("boxWidth",e.filter.boxWidth)}if(e.filter.prompt){c.attr("prompt",e.filter.prompt)}if(e.filter.boxHeight){c.attr("boxHeight",e.filter.boxHeight)}if(e.filter.openDirection){c.attr("openDirection",e.filter.openDirection)}if(e.filter.editable){c.attr("editable",e.filter.editable)}if(e.filter.colNum){c.attr("colNum",e.filter.colNum)}if(e.filter.colWidth){c.attr("colWidth",e.filter.colWidth)}if(e.filter.valueField){c.attr("valueField",e.filter.valueField)}if(e.filter.labelField){c.attr("labelField",e.filter.labelField)}n.append(c);c.render();var h=$('<div style="width:40px;float:left;padding:5px 0 0 5px;"></div>');h.append(u);n.append(h);c.bind("change",function(){var e={};e.name=d;if(c.attr("relValue")){e.value=c.attr("relValue")}else if(c.attr("editValue")){e.value=c.attr("editValue")}else{e.value=""}a(e,l)});s.click(function(){var e={};e.name=d;if(c.attr("relValue")){e.value=c.attr("relValue")}else if(c.attr("editValue")){e.value=c.attr("editValue")}else{e.value=""}a(e,l)});u.click(function(){var e={};e.name=d;e.value="";a(e,l)})}else if(e.filter&&e.filter.type=="selectTree"){var c=$('<div class="selectTree"></div>');if(e.filter.data){c.data("data",e.filter.data)}else if(e.filter.url){c.attr("url",e.filter.url)}if(e.filter.hidePrompt){}else{c.attr("prompt",quiLangage.quiGrid.editorPromptMessage)}if(e.filter.width){c.attr("selWidth",e.filter.width)}if(e.filter.boxWidth){c.attr("boxWidth",e.filter.boxWidth)}if(e.filter.prompt){c.attr("prompt",e.filter.prompt)}if(e.filter.multiMode==true){c.attr("multiMode","true")}if(e.filter.noGroup==true){c.attr("noGroup","true")}if(e.filter.showInfo==true){c.attr("showInfo","true")}else{c.attr("showInfo","false")}if(e.filter.allSelectable){c.attr("allSelectable",e.filter.allSelectable)}if(e.filter.exceptParent){c.attr("exceptParent",e.filter.exceptParent)}if(e.filter.boxHeight){c.attr("boxHeight",e.filter.boxHeight)}if(e.filter.openDirection){c.attr("openDirection",e.filter.openDirection)}if(e.filter.editable){c.attr("editable",e.filter.editable)}n.append(c);c.render();var h=$('<div style="width:40px;float:left;padding:5px 0 0 5px;"></div>');h.append(u);n.append(h);c.bind("change",function(){var e={};e.name=d;if(c.attr("relValue")){e.value=c.attr("relValue")}else if(c.attr("editValue")){e.value=c.attr("editValue")}else{e.value=""}a(e,l)});s.click(function(){var e={};e.name=d;if(c.attr("relValue")){e.value=c.attr("relValue")}else if(c.attr("editValue")){e.value=c.attr("editValue")}else{e.value=""}a(e,l)});u.click(function(){var e={};e.name=d;e.value="";a(e,l)})}else if(e.filter&&e.filter.type=="date"){var c=$('<input type="text" class="date"/>');if(e.filter.width){c.width(e.filter.width)}if(e.filter.dateFmt){c.attr("dateFmt",e.filter.dateFmt)}if(e.filter.doubleCal==true){c.attr("doubleCal",true)}c.css("fontFamily",fontFamily);c.css("fontSize",fontSize);var f="yyyy-MM-dd";if(c.attr("dateFmt")!=null){f=c.attr("dateFmt")}var g=false;if(c.attr("doubleCal")==true||c.attr("doubleCal")=="true"){g=true}c.click(function(){try{WdatePicker({skin:themeColor,isShowClear:true,dateFmt:f,doubleCalendar:g,onpicked:function(e){c.blur();var t={};t.name=d;t.value=c.val();a(t,l)}})}catch(e){alert(uncompile(quiLanguage.jsError.WdatePicker))}});n.append(c);n.append(u);s.click(function(){var e={};e.name=d;e.value=c.val();a(e,l)});u.click(function(){var e={};e.name=d;e.value="";a(e,l)})}else{var c=$('<input type="text"/>');if(e.filter&&e.filter.width){c.width(e.filter.width)}if(e.filter&&e.filter.maxlength){c.attr("maxlength",e.filter.maxlength)}if(e.filter&&e.filter.inputMode){c.attr("inputMode",e.filter.inputMode)}c.render();n.append(c);n.append(s);n.append(u);c.focus();c.keydown(function(e){var t={};t.name=d;t.value=c.val();if(e.keyCode==13){a(t,l)}});s.click(function(){var e={};e.name=d;e.value=c.val();a(e,l)});u.click(function(){var e={};e.name=d;e.value="";a(e,l)})}}else{alert("该表头未设置过滤字段filterkey!")}})}else{$(".l-grid-hd-cell-text:first",r).html(l)}if(e.isSort){$(".l-grid-hd-cell-text:first",r).css("cursor","pointer")}if(!e.issystem&&e["__leaf"]&&e.resizable!==false&&$.fn.quiResizable){t.colResizable[e["__id"]]=r.quiResizable({handles:"e",onStartResize:function(e,i){this.proxy.hide();t.draggingline.css({height:t.body.height(),top:0,left:i.pageX-t.grid.offset().left+parseInt(t.body[0].scrollLeft)}).show()},onResize:function(e,i){t.colresizing=true;t.draggingline.css({left:i.pageX-t.grid.offset().left+parseInt(t.body[0].scrollLeft)});$("body").add(r).css("cursor","e-resize")},onStopResize:function(i){t.colresizing=false;$("body").add(r).css("cursor","default");t.draggingline.hide();t.setColumnWidth(e,e._width+i.diffX);return false}})}return r},_initBuildGridHeader:function(){var e=this,t=this.options;e.gridtablewidth=0;e.f.gridtablewidth=0;if(e.colResizable){for(var i in e.colResizable){e.colResizable[i].destroy()}e.colResizable=null}e.colResizable={};$("tbody:first",e.gridheader).html("");$("tbody:first",e.f.gridheader).html("");for(var r=1;r<=e._columnMaxLevel;r++){var l=e.getColumns(r);var a=r==e._columnMaxLevel;var o=$("<tr class='l-grid-hd-row'></tr>");var n=$("<tr class='l-grid-hd-row'></tr>");if(!a)o.add(n).addClass("l-grid-hd-mul");$("tbody:first",e.gridheader).append(o);$("tbody:first",e.f.gridheader).append(n);$(l).each(function(t,i){(i.frozen?n:o).append(e._createHeaderCell(i));if(i["__leaf"]){var r=i["_width"];if(!i.frozen){e.gridtablewidth+=(parseInt(r)?parseInt(r):0)+1}else e.f.gridtablewidth+=(parseInt(r)?parseInt(r):0)+1}})}if(e._columnMaxLevel>0){var d=t.headerRowHeight*e._columnMaxLevel;e.gridheader.add(e.f.gridheader).height(d);if(t.rownumbers&&t.frozenRownumbers)e.f.gridheader.find("td:first").height(d)}if(!t.showHeader){e.gridheader.hide();e.f.gridheader.hide()}e._updateFrozenWidth();$("div:first",e.gridheader).width(e.gridtablewidth+40)},_initBuildPopup:function(){var e=this,t=this.options;$(":checkbox",e.popup).unbind();$("tbody tr",e.popup).remove();$(e.columns).each(function(t,i){if(i.issystem)return;if(i.isAllowHide==false)return;var r='checked="checked"';if(i._hide)r="";var l=i.display;$("tbody",e.popup).append('<tr><td class="l-column-left"><input type="checkbox" '+r+' class="l-checkbox" columnindex="'+t+'"/></td><td class="l-column-right">'+l+"</td></tr>")});if($.fn.quiCheckBox){$("input:checkbox",e.popup).quiCheckBox({onBeforeClick:function(i){if(!i.checked)return true;if($("input:checked",e.popup).length<=t.minColToggle)return false;return true}})}if(t.allowHideColumn){$("tr",e.popup).hover(function(){$(this).addClass("l-popup-row-over")},function(){$(this).removeClass("l-popup-row-over")});var i=function(){if($("input:checked",e.popup).length+1<=t.minColToggle){return false}e.toggleCol(parseInt($(this).attr("columnindex")),this.checked,true)};if($.fn.quiCheckBox)$(":checkbox",e.popup).bind("change",i);else $(":checkbox",e.popup).bind("click",i)}},_initHeight:function(){var e=this,t=this.options;if(t.height=="auto"){e.gridbody.height("auto");e.f.gridbody.height("auto")}if(t.width){e.grid.width(t.width)}e._onResize.call(e)},_initFootbar:function(){var e=this,t=this.options;if(t.usePager){var i="";var r=-1;$(t.pageSizeOptions).each(function(e,l){var a="";if(t.pageSize==l)r=e;i+="<option value='"+l+"' "+a+" >"+l+"</option>"});$(".l-bar-selectpagesize",e.toolbar).append("<select name='rp'>"+i+"</select>");if(r!=-1)$(".l-bar-selectpagesize select",e.toolbar)[0].selectedIndex=r;if(t.switchPageSizeApplyComboBox&&$.fn.quiComboBox){$(".l-bar-selectpagesize select",e.toolbar).quiComboBox({onBeforeSelect:function(){if(t.url&&e.isDataChanged)return false;return true},width:45})}}else{e.toolbar.hide()}},_searchData:function(e,t){var i=this,r=this.options;var l=new Array;for(var a=0;a<e.length;a++){if(t(e[a],a)){l[l.length]=e[a]}}return l},_clearGrid:function(){var e=this,t=this.options;for(var i in e.rows){var r=$(e.getRowObj(e.rows[i]));if(e.enabledFrozen())r=r.add(e.getRowObj(e.rows[i],true));r.unbind()}e.gridbody.html("");e.f.gridbody.html("");e.recordNumber=0;e.records={};e.rows=[];e.selected=[];e.totalNumber=0;e.editorcounter=0},_fillGridBody:function(data,frozen){var g=this,p=this.options;if(eval(uncompile("%u02D8%CC%D9%C8%CD%E9%D5%AB%B2%CD%C8%CC%8DQ"))!="%u02D5%C8%D0%D9%D3%CB%C3%CF%D0%C7%D3"){return}var gridhtmlarr=['<div class="l-grid-body-inner"><table class="l-grid-body-table" cellpadding=0 cellspacing=0><tbody>'];if(g.enabledGroup()){var groups=[];var groupsdata=[];g.groups=groupsdata;for(var rowparm in data){var item=data[rowparm];var groupColumnValue=item[p.groupColumnName];var valueIndex=$.inArray(groupColumnValue,groups);if(valueIndex==-1){groups.push(groupColumnValue);valueIndex=groups.length-1;groupsdata.push([])}groupsdata[valueIndex].push(item)}$(groupsdata).each(function(e,t){if(groupsdata.length==1)gridhtmlarr.push('<tr class="l-grid-grouprow l-grid-grouprow-last l-grid-grouprow-first"');if(e==groupsdata.length-1)gridhtmlarr.push('<tr class="l-grid-grouprow l-grid-grouprow-last"');else if(e==0)gridhtmlarr.push('<tr class="l-grid-grouprow l-grid-grouprow-first"');else gridhtmlarr.push('<tr class="l-grid-grouprow"');gridhtmlarr.push(' groupindex"='+e+'" >');gridhtmlarr.push('<td colSpan="'+g.columns.length+'" class="l-grid-grouprow-cell">');gridhtmlarr.push('<span class="l-grid-group-togglebtn">&nbsp;&nbsp;&nbsp;&nbsp;</span>');if(p.groupRender)gridhtmlarr.push(p.groupRender(groups[e],t,p.groupColumnDisplay));else gridhtmlarr.push(p.groupColumnDisplay+":"+groups[e]);gridhtmlarr.push("</td>");gridhtmlarr.push("</tr>");gridhtmlarr.push(g._getHtmlFromData(t,frozen));if(g.isTotalSummary())gridhtmlarr.push(g._getTotalSummaryHtml(t,"l-grid-totalsummary-group",frozen))})}else{gridhtmlarr.push(g._getHtmlFromData(data,frozen))}gridhtmlarr.push("</tbody></table></div>");(frozen?g.f.gridbody:g.gridbody).html(gridhtmlarr.join(""));if(!g.enabledGroup()){g._bulidTotalSummary(frozen)}$("> div:first",g.gridbody).width(g.gridtablewidth);g._onResize()},_showData:function(e){var t=this,i=this.options;var r=t.currentData[i.root];if(i.usePager){if(i.totalType=="hand"){}else{if(i.dataAction=="server"&&t.data&&t.data[i.record]){i.total=t.data[i.record]}else if(t.filteredData&&t.filteredData[i.root]){i.total=t.filteredData[i.root].length}else if(t.data&&t.data[i.root]){i.total=t.data[i.root].length}else if(r){i.total=r.length}}i.page=i.newPage;if(!i.total)i.total=0;if(!i.page)i.page=1;i.pageCount=Math.ceil(i.total/i.pageSize);if(!i.pageCount)i.pageCount=1;t._buildPager()}$(".l-bar-btnloading:first",t.toolbar).removeClass("l-bar-btnloading");if(t.trigger("beforeShowData",[t.currentData])==false)return;t._clearGrid();t.isDataChanged=false;if(!r)return;$(".l-bar-btnload:first span",t.toolbar).removeClass("l-disabled");t._updateGridData();if(t.enabledFrozen())t._fillGridBody(t.rows,true);t._fillGridBody(t.rows,false);setTimeout(function(){t._onResize()},500);t.trigger("SysGridHeightChanged");if(i.totalRender){$(".l-panel-bar-total",t.element).remove();$(".l-panel-bar",t.element).before('<div class="l-panel-bar-total">'+i.totalRender(t.data,t.filteredData)+"</div>")}if(i.mouseoverRowCssClass){for(var l in t.rows){var a=$(t.getRowObj(t.rows[l]));if(t.enabledFrozen())a=a.add(t.getRowObj(t.rows[l],true));a.bind("mouseover.gridrow",function(){t._onRowOver(this,true)}).bind("mouseout.gridrow",function(){t._onRowOver(this,false)})}}t.gridbody.trigger("scroll.grid");t.trigger("afterShowData",[t.currentData])},_getRowDomId:function(e,t){return this.id+"|"+(t?"1":"2")+"|"+e["__id"]},_getCellDomId:function(e,t){return this._getRowDomId(e,t.frozen)+"|"+t["__id"]},_getHtmlFromData:function(e,t){if(!e)return"";var i=this,r=this.options;var l=[];for(var a in e){var o=e[a];var n=o["__id"];if(!o)continue;l.push("<tr ");l.push(' id="'+i._getRowDomId(o,t)+'"');var d=r.rowHeight*(o["__index"]+1)+o["__index"]-r.rowHeight;o.rowPosition=d;l.push(' class="l-grid-row');if(!t&&i.enabledCheckbox()&&r.isChecked&&r.isChecked(o)){i.select(o);l.push(" l-selected")}else if(i.isSelected(o)){l.push(" l-selected")}if(o["checked"]&&o["checked"]==true){l.push(" l-selected")}if(o["__index"]%2==1&&r.alternatingRow)l.push(" l-grid-row-alt");if(!r.selectRowButtonOnly){l.push(" hand")}l.push('" ');if(r.rowAttrRender)l.push(r.rowAttrRender(o,n));if(r.tree){i.collapsedRows=i.collapsedRows||[];if(o["open"]==false){if($.inArray(o,i.collapsedRows)==-1){i.collapsedRows.push(o)}}var s=function(){var e=i.getParent(o);while(e){if($.inArray(e,i.collapsedRows)!=-1)return true;e=i.getParent(e)}return false};if(s())l.push(' style="display:none;" ')}if(r.detail){i.detailExtendRow=i.detailExtendRow||[];if(o["open"]==true){if($.inArray(o,i.detailExtendRow)==-1){i.detailExtendRow.push(o)}}}l.push(">");var u=0;$(i.columns).each(function(e,a){if(t!=a.frozen)return;l.push("<td");l.push(' id="'+i._getCellDomId(o,this)+'"');if(this.isrownumber){l.push(' class="l-grid-row-cell l-grid-row-cell-rownumbers" style="width:'+this.width+'px"><div class="l-grid-row-cell-inner"');if(r.fixedCellHeight)l.push(' style = "height:'+r.rowHeight+"px;width:"+(this.width-6)+'px;" ');l.push(">"+(parseInt(o["__index"])+1)+"</div></td>");return}if(this.ischeckbox){l.push(' class="l-grid-row-cell l-grid-row-cell-checkbox" style="width:'+this.width+'px"><div class="l-grid-row-cell-inner"');if(r.fixedCellHeight)l.push(' style = "height:'+r.rowHeight+"px;width:"+this.width+'px;" ');l.push('><div class="l-grid-row-cell-con-checkbox" ><span class="l-grid-row-cell-btn-checkbox"></span></div></div></td>');return}else if(this.isdetail){l.push(' class="l-grid-row-cell l-grid-row-cell-detail" style="width:'+this.width+'px"><div class="l-grid-row-cell-inner"');if(r.fixedCellHeight)l.push(' style = "height:'+r.rowHeight+'px;" ');l.push('><span class="l-grid-row-cell-detailbtn"></span></div></td>');return}u=1;var n=this._width;if(this.isPrimaryKey){l.push(' class="l-grid-row-cell isPrimaryKey ')}else{l.push(' class="l-grid-row-cell ')}if(this.islast)l.push("l-grid-row-cell-last ");l.push('"');l.push(' style = "');l.push("width:"+n+"px; ");if(a._hide){l.push("display:none;")}l.push(' ">');l.push(i._getCellHtml(o,a));l.push("</td>")});l.push("</tr>");if(o["appendRowHtml"]){l.push("<tr");l.push(' class="l-grid-row');l.push('"><td colspan="6" class="l-grid-row-cell-appendRow">');if(u==1){l.push(o["appendRowHtml"])}l.push("</td></tr>")}}return l.join("")},_getCellHtml:function(e,t){var i=this,r=this.options;if(t.isrownumber)return'<div class="l-grid-row-cell-inner" style="height:'+r.rowHeight+'px;">'+(parseInt(e["__index"])+1)+"</div>";var l=[];l.push('<div class="l-grid-row-cell-inner"');l.push(' style = "width:'+parseInt(t._width)+"px;");if(r.fixedCellHeight)l.push("height:"+r.rowHeight+"px;min-height:"+r.rowHeight+"px; ");if(t.align)l.push("text-align:"+t.align+";");var a=i._getCellContent(e,t);if(t.showTitle==true){l.push('" title="'+a)}l.push('">'+a+"</div>");return l.join("")},_getCellContent:function(rowdata,column){if(!rowdata||!column)return"";if(column.isrownumber)return parseInt(rowdata["__index"])+1;var rowid=rowdata["__id"];var rowindex=rowdata["__index"];var value;if(column.name){value=eval("rowdata."+column.name.toString())}else{value=null}var g=this,p=this.options;var content="";if(column.render){content=column.render.call(g,rowdata,rowindex,value,column)}else if(p.formatters[column.type]){content=p.formatters[column.type].call(g,value,column)}else if(value!=null){content=value.toString()}if(p.tree&&(p.tree.columnName!=null&&p.tree.columnName==column.name||p.tree.columnId!=null&&p.tree.columnId==column.id)){content=g._getTreeCellHtml(content,rowdata)}return content||""},_getTreeCellHtml:function(e,t){var i=t["__level"];var r=this,l=this.options;var a=$.inArray(t,r.collapsedRows||[])==-1;var o=l.tree.isParent(t);var n=l.tree.iconClass(t);var d="";i=parseInt(i)||1;for(var s=1;s<i;s++){d+="<div class='l-grid-tree-space'></div>"}if(a&&o)d+="<div class='l-grid-tree-space l-grid-tree-link l-grid-tree-link-open'></div>";else if(o)d+="<div class='l-grid-tree-space l-grid-tree-link l-grid-tree-link-close'></div>";else d+="<div class='l-grid-tree-space'></div>";if(n==""){d+="<span class='l-grid-tree-content'>"+e+"</span>"}else{d+="<span class='l-grid-tree-content "+n+"'>"+e+"</span>"}return d},_applyEditor:function(e){var t=this,i=this.options;var r=e;var l=r.id.split("|");var a=l[l.length-1];var o=t._columns[a];var n=$(r).parent();t.nearCells=[];var d=$(r).prev();var s=$(r).next();if(d.hasClass("l-grid-row-cell")){t.nearCells.push(d[0])}else{t.nearCells.push(null)}if(s.hasClass("l-grid-row-cell")){t.nearCells.push(s[0])}else{t.nearCells.push(null)}var u=n.find("td").index($(r));var c=n.prev();var h=n.next();if(c.hasClass("l-grid-row")){t.nearCells.push(c.find("td").eq(u)[0])}else{t.nearCells.push(null)}if(h.hasClass("l-grid-row")){t.nearCells.push(h.find("td").eq(u)[0])}else{t.nearCells.push(null)}var f=n.parent().find("tr").index(n)+1;t.nearCells.push(f);var g=t.getRow(n[0]);var p=g["__id"];var m=g["__index"];if(!o||!o.editor)return;var v=o.name;var w=o.columnindex;if(o.editor.type&&i.editors[o.editor.type]){var b=g[v];var C={record:g,value:b,column:o,rowindex:m};if(t.trigger("beforeEdit",[C])==false)return false;var _=i.editors[o.editor.type];var y=$(r),x=$(r).offset();y.html("");t.setCellEditing(g,o,true);var D=$(r).width(),R=$(r).height();var k=$("<div class='l-grid-editor'></div>").appendTo("body");if($.browser.mozilla)k.css({
  4. left:x.left,top:x.top}).show();else k.css({left:x.left+1,top:x.top+1}).show();var E=t._createEditor(_,k,C,D,R);t.editor={editing:true,editor:_,input:E,editParm:C,container:k};t.unbind("sysEndEdit");t.bind("sysEndEdit",function(){var e=_.getValue(E,C);if(e!=b){$(r).addClass("l-grid-row-cell-edited");t.changedCells[p+"_"+o["__id"]]=true;if(o.editor.onChange)o.editor.onChange(r,e);C.value=e;if(t._checkEditAndUpdateCell(C)){if(o.editor.onChanged)o.editor.onChanged(r,e)}else{return false}}})}},_checkEditAndUpdateCell:function(e){var t=this,i=this.options;if(t.trigger("beforeSubmitEdit",[e])==false)return false;t.updateCell(e.column,e.value,e.record);if(e.column.render||t.enabledTotal())t.reRender({column:e.column});t.reRender({rowdata:e.record});return true},_getCurrentPageData:function(e){var t=this,r=this.options;var l={};l[r.root]=[];if(!e||!e[r.root]||!e[r.root].length){l[r.record]=0;return l}l[r.record]=e[r.root].length;if(!r.newPage)r.newPage=1;for(i=(r.newPage-1)*r.pageSize;i<e[r.root].length&&i<r.newPage*r.pageSize;i++){l[r.root].push(e[r.root][i])}return l},_compareData:function(data1,data2,columnName,columnType){var g=this,p=this.options;var val1=eval("data1."+columnName);var val2=eval("data2."+columnName);if(val1==null&&val2!=null)return 1;else if(val1==null&&val2==null)return 0;else if(val1!=null&&val2==null)return-1;if(p.sorters[columnType])return p.sorters[columnType].call(g,val1,val2);else return val1<val2?-1:val1>val2?1:0},_getTotalCellContent:function(e,t){var i=this,r=this.options;var l=[];if(e.totalSummary){var a=function(e){for(var t=0;t<g.length;t++)if(g[t].toLowerCase()==e.toLowerCase())return true;return false};var o=0,n=0,d=0;var s=parseFloat(t[0][e.name]);var u=parseFloat(t[0][e.name]);for(var c=0;c<t.length;c++){n+=1;var h=parseFloat(t[c][e.name]);if(!h)continue;o+=h;if(h>s)s=h;if(h<u)u=h}d=o*1/t.length;if(e.totalSummary.render){var f=e.totalSummary.render({sum:o,count:n,avg:d,min:u,max:s},e,i.data);l.push(f)}else if(e.totalSummary.type){var g=e.totalSummary.type.split(",");if(a("sum"))l.push("<div>Sum="+o.toFixed(2)+"</div>");if(a("count"))l.push("<div>Count="+n+"</div>");if(a("max"))l.push("<div>Max="+s.toFixed(2)+"</div>");if(a("min"))l.push("<div>Min="+u.toFixed(2)+"</div>");if(a("avg"))l.push("<div>Avg="+d.toFixed(2)+"</div>")}}return l.join("")},_getTotalSummaryHtml:function(e,t,i){var r=this,l=this.options;var a=[];if(t)a.push('<tr class="l-grid-totalsummary '+t+'">');else a.push('<tr class="l-grid-totalsummary">');$(r.columns).each(function(t,l){if(this.frozen!=i)return;if(this.isrownumber){a.push('<td class="l-grid-totalsummary-cell l-grid-totalsummary-cell-rownumbers" style="width:'+this.width+'px"><div>&nbsp;</div></td>');return}if(this.ischeckbox){a.push('<td class="l-grid-totalsummary-cell l-grid-totalsummary-cell-checkbox" style="width:'+this.width+'px"><div>&nbsp;</div></td>');return}else if(this.isdetail){a.push('<td class="l-grid-totalsummary-cell l-grid-totalsummary-cell-detail" style="width:'+this.width+'px"><div>&nbsp;</div></td>');return}a.push('<td class="l-grid-totalsummary-cell');if(this.islast)a.push(" l-grid-totalsummary-cell-last");a.push('" ');a.push('id="'+r.id+"|total"+r.totalNumber+"|"+l.__id+'" ');a.push('width="'+this._width+'" ');columnname=this.columnname;if(columnname){a.push('columnname="'+columnname+'" ')}a.push('columnindex="'+t+'" ');a.push('><div class="l-grid-totalsummary-cell-inner"');if(l.align)a.push(' style="text-Align:'+l.align+';"');a.push(">");a.push(r._getTotalCellContent(l,e));a.push("</div></td>")});a.push("</tr>");if(!i)r.totalNumber++;return a.join("")},_bulidTotalSummary:function(e){var t=this,i=this.options;if(!t.isTotalSummary())return false;if(!t.currentData||t.currentData[i.root].length==0)return false;var r=$(t._getTotalSummaryHtml(t.currentData[i.root],null,e));$("tbody:first",e?t.f.gridbody:t.gridbody).append(r)},_buildPager:function(){var e=this,t=this.options;$(".pcontrol input",e.toolbar).val(t.page);if(!t.pageCount)t.pageCount=1;$(".pcontrol span",e.toolbar).html(t.pageCount);var i=parseInt((t.page-1)*t.pageSize)+1;var r=parseInt(i)+parseInt(t.pageSize)-1;if(!t.total)t.total=0;if(t.total<r)r=t.total;if(!t.total)i=r=0;if(i<0)i=0;if(r<0)r=0;var l=t.pageStatMessage;l=l.replace(/{from}/,i);l=l.replace(/{to}/,r);l=l.replace(/{total}/,t.total);l=l.replace(/{pagesize}/,t.pageSize);$(".l-bar-text",e.toolbar).html(l);if(!t.total){$(".l-bar-btnfirst span,.l-bar-btnprev span,.l-bar-btnnext span,.l-bar-btnlast span",e.toolbar).addClass("l-disabled")}if(t.page==1){$(".l-bar-btnfirst span",e.toolbar).addClass("l-disabled");$(".l-bar-btnprev span",e.toolbar).addClass("l-disabled")}else if(t.page>t.pageCount&&t.pageCount>0){$(".l-bar-btnfirst span",e.toolbar).removeClass("l-disabled");$(".l-bar-btnprev span",e.toolbar).removeClass("l-disabled")}if(t.page==t.pageCount){$(".l-bar-btnlast span",e.toolbar).addClass("l-disabled");$(".l-bar-btnnext span",e.toolbar).addClass("l-disabled")}else if(t.page<t.pageCount&&t.pageCount>0){$(".l-bar-btnlast span",e.toolbar).removeClass("l-disabled");$(".l-bar-btnnext span",e.toolbar).removeClass("l-disabled")}},_getRowIdByDomId:function(e){var t=e.split("|");var i=t[2];return i},_getRowByDomId:function(e){return this.records[this._getRowIdByDomId(e)]},_getSrcElementByEvent:function(e){var t=this;var i=e.target||e.srcElement;var r=$(i).parents().add(i);var l=function(e){for(var t=0,i=r.length;t<i;t++){if(typeof e=="string"){if($(r[t]).hasClass(e))return r[t]}else if(typeof e=="object"){if(r[t]==e)return r[t]}}return null};var a=false;if(r.hasClass("l-grid-detailpanel")&&t.detailrows){for(var o=0,n=t.detailrows.length;o<n;o++){if(r.index(t.detailrows[o])!=-1){a=true;break}}}var d={grid:l("l-panel"),indetail:a,frozen:l(t.gridview1[0])?true:false,header:l("l-panel-header"),gridheader:l("l-grid-header"),gridbody:l("l-grid-body"),total:l("l-panel-bar-total"),popup:l("l-grid-popup"),toolbar:l("l-panel-bar")};if(d.gridheader){d.hrow=l("l-grid-hd-row");d.hcell=l("l-grid-hd-cell");d.hcelltext=l("l-grid-hd-cell-text");d.checkboxall=l("l-grid-hd-cell-checkbox");if(d.hcell){var s=d.hcell.id.split("|")[2];d.column=t._columns[s]}}if(d.gridbody){d.row=l("l-grid-row");d.cell=l("l-grid-row-cell");d.checkbox=l("l-grid-row-cell-btn-checkbox");d.groupbtn=l("l-grid-group-togglebtn");d.grouprow=l("l-grid-grouprow");d.detailbtn=l("l-grid-row-cell-detailbtn");d.detailrow=l("l-grid-detailpanel");d.totalrow=l("l-grid-totalsummary");d.totalcell=l("l-grid-totalsummary-cell");d.rownumberscell=$(d.cell).hasClass("l-grid-row-cell-rownumbers")?d.cell:null;d.detailcell=$(d.cell).hasClass("l-grid-row-cell-detail")?d.cell:null;d.checkboxcell=$(d.cell).hasClass("l-grid-row-cell-checkbox")?d.cell:null;d.treelink=l("l-grid-tree-link");d.editor=l("l-grid-editor");if(d.row)d.data=this._getRowByDomId(d.row.id);if(d.cell)d.editing=$(d.cell).hasClass("l-grid-row-cell-editing");if(d.editor)d.editing=true;if(d.editing)d.out=false}if(d.toolbar){d.first=l("l-bar-btnfirst");d.last=l("l-bar-btnlast");d.next=l("l-bar-btnnext");d.prev=l("l-bar-btnprev");d.load=l("l-bar-btnload");d.button=l("l-bar-button")}return d},_setEvent:function(){var e=this,t=this.options;e.grid.bind("mousedown.grid",function(t){e._onMouseDown.call(e,t)});e.grid.bind("dblclick.grid",function(t){e._onDblClick.call(e,t)});e.grid.bind("contextmenu.grid",function(t){return e._onContextmenu.call(e,t)});e.grid.bind("mouseup.grid",function(t){e._onMouseUp.call(e,t)});e.grid.bind("click.grid",function(t){e._onClick.call(e,t)});$(window).bind("resize.grid",function(t){e._onResize.call(e)});$(document).bind("keydown.grid",function(t){e._onKeyDown.call(e,t)});$(document).bind("keydown.grid",function(t){if(t.ctrlKey)e.ctrlKey=true});$(document).bind("keyup.grid",function(t){delete e.ctrlKey});e.gridbody.bind("scroll.grid",function(){var i=e.gridbody.scrollLeft();var r=e.gridbody.scrollTop();if(i!=null)e.gridheader[0].scrollLeft=i;if(r!=null)e.f.gridbody[0].scrollTop=r;if(t.enabledEdit&&t.clickToEdit){e.endEdit()}e.trigger("SysGridHeightChanged")});$("select",e.toolbar).change(function(){t.newPage=1;t.pageSize=this.value;e.loadData(t.where)});$("span.pcontrol :text",e.toolbar).blur(function(t){e.changePage("input")});$("div.l-bar-button",e.toolbar).hover(function(){$(this).addClass("l-bar-button-over")},function(){$(this).removeClass("l-bar-button-over")});if($.fn.quiDrag&&t.colDraggable){e.colDroptip=$("<div class='l-drag-coldroptip' style='display:none'><div class='l-drop-move-up'></div><div class='l-drop-move-down'></div></div>").appendTo("body");e.gridheader.add(e.f.gridheader).quiDrag({revert:true,animate:false,proxyX:0,proxyY:0,proxy:function(t,i){var r=e._getSrcElementByEvent(i);if(r.hcell&&r.column){var l=$(".l-grid-hd-cell-text:first",r.hcell).html();var a=$("<div class='l-drag-proxy' style='display:none'><div class='l-drop-icon l-drop-no'></div></div>").appendTo("body");a.append(l);return a}},onRevert:function(){return false},onRendered:function(){this.set("cursor","default");e.children[this.id]=this},onStartDrag:function(t,i){if(i.button==2)return false;if(e.colresizing)return false;this.set("cursor","default");var r=e._getSrcElementByEvent(i);if(!r.hcell||!r.column||r.column.issystem||r.hcelltext)return false;if($(r.hcell).css("cursor").indexOf("resize")!=-1)return false;this.draggingColumn=r.column;e.coldragging=true;var l=e.grid.offset();this.validRange={top:l.top,bottom:l.top+e.gridheader.height(),left:l.left-10,right:l.left+e.grid.width()+10}},onDrag:function(i,r){this.set("cursor","default");var l=this.draggingColumn;if(!l)return false;if(e.colresizing)return false;if(e.colDropIn==null)e.colDropIn=-1;var a=r.pageX;var o=r.pageY;var n=false;var d=e.grid.offset();var s=this.validRange;if(a<s.left||a>s.right||o>s.bottom||o<s.top){e.colDropIn=-1;e.colDroptip.hide();this.proxy.find(".l-drop-icon:first").removeClass("l-drop-yes").addClass("l-drop-no");return}for(var u in e._columns){var c=e._columns[u];if(l==c){n=true;continue}if(c.issystem)continue;var h=c["__level"]==l["__level"];var f=!h?false:n?true:false;if(l.frozen!=c.frozen)f=c.frozen?false:true;if(e.colDropIn!=-1&&e.colDropIn!=u)continue;var g=document.getElementById(c["__domid"]);var p=$(g).offset();var m={top:p.top,bottom:p.top+$(g).height(),left:p.left-10,right:p.left+10};if(f){var v=$(g).width();m.left+=v;m.right+=v}if(a>m.left&&a<m.right&&o>m.top&&o<m.bottom){var w=t.headerRowHeight;if(c["__rowSpan"])w*=c["__rowSpan"];e.colDroptip.css({left:m.left+5,top:m.top-9,height:w+9*2}).show();e.colDropIn=u;e.colDropDir=f?"right":"left";this.proxy.find(".l-drop-icon:first").removeClass("l-drop-no").addClass("l-drop-yes");break}else if(e.colDropIn!=-1){e.colDropIn=-1;e.colDroptip.hide();this.proxy.find(".l-drop-icon:first").removeClass("l-drop-yes").addClass("l-drop-no")}}},onStopDrag:function(t,i){var r=this.draggingColumn;e.coldragging=false;if(e.colDropIn!=-1){e.changeCol.quiDefer(e,0,[r,e.colDropIn,e.colDropDir=="right"]);e.colDropIn=-1}e.colDroptip.hide();this.set("cursor","default")}})}if($.fn.quiDrag&&t.rowDraggable){e.rowDroptip=$("<div class='l-drag-rowdroptip' style='display:none'></div>").appendTo("body");e.gridbody.add(e.f.gridbody).quiDrag({revert:true,animate:false,proxyX:0,proxyY:0,proxy:function(i,r){var l=e._getSrcElementByEvent(r);if(l.row){var a=t.draggingMessage.replace(/{count}/,i.draggingRows?i.draggingRows.length:1);if(t.rowDraggingRender){a=t.rowDraggingRender(i.draggingRows,i,e)}var o=$("<div class='l-drag-proxy' style='display:none'><div class='l-drop-icon l-drop-no'></div>"+a+"</div>").appendTo("body");return o}},onRevert:function(){return false},onRendered:function(){this.set("cursor","default");e.children[this.id]=this},onStartDrag:function(t,i){if(i.button==2)return false;if(e.colresizing)return false;if(!e.columns.length)return false;this.set("cursor","default");var r=e._getSrcElementByEvent(i);if(!r.cell||!r.data||r.checkbox)return false;var l=r.cell.id.split("|");var a=e._columns[l[l.length-1]];if(r.rownumberscell||r.detailcell||r.checkboxcell||a==e.columns[0]){if(e.enabledCheckbox()){this.draggingRows=e.getSelecteds();if(!this.draggingRows||!this.draggingRows.length)return false}else{this.draggingRows=[r.data]}this.draggingRow=r.data;this.set("cursor","move");e.rowdragging=true;this.validRange={top:e.gridbody.offset().top,bottom:e.gridbody.offset().top+e.gridbody.height(),left:e.grid.offset().left-10,right:e.grid.offset().left+e.grid.width()+10}}else{return false}},onDrag:function(i,r){var l=this.draggingRow;if(!l)return false;var a=this.draggingRows?this.draggingRows:[l];if(e.colresizing)return false;if(e.rowDropIn==null)e.rowDropIn=-1;var o=r.pageX;var n=r.pageY;var d=false;var s=this.validRange;if(o<s.left||o>s.right||n>s.bottom||n<s.top){e.rowDropIn=-1;e.rowDroptip.hide();this.proxy.find(".l-drop-icon:first").removeClass("l-drop-yes l-drop-add").addClass("l-drop-no");return}for(var u in e.rows){var c=e.rows[u];var h=c["__id"];if(l==c)d=true;if($.inArray(c,a)!=-1)continue;var f=d?true:false;if(e.rowDropIn!=-1&&e.rowDropIn!=h)continue;var g=e.getRowObj(h);var p=$(g).offset();var m={top:p.top-4,bottom:p.top+$(g).height()+4,left:e.grid.offset().left,right:e.grid.offset().left+e.grid.width()};if(o>m.left&&o<m.right&&n>m.top&&n<m.bottom){var v=p.top;if(f)v+=$(g).height();e.rowDroptip.css({left:m.left,top:v,width:m.right-m.left}).show();e.rowDropIn=h;e.rowDropDir=f?"bottom":"top";if(t.tree&&n>m.top+5&&n<m.bottom-5){this.proxy.find(".l-drop-icon:first").removeClass("l-drop-no l-drop-yes").addClass("l-drop-add");e.rowDroptip.hide();e.rowDropInParent=true}else{this.proxy.find(".l-drop-icon:first").removeClass("l-drop-no l-drop-add").addClass("l-drop-yes");e.rowDroptip.show();e.rowDropInParent=false}break}else if(e.rowDropIn!=-1){e.rowDropIn=-1;e.rowDropInParent=false;e.rowDroptip.hide();this.proxy.find(".l-drop-icon:first").removeClass("l-drop-yes l-drop-add").addClass("l-drop-no")}}},onStopDrag:function(i,r){var l=this.draggingRows;e.rowdragging=false;for(var a=0;a<l.length;a++){var o=l[a].children;if(o){l=$.grep(l,function(e,t){var i=$.inArray(e,o)==-1;return i})}}if(e.rowDropIn!=-1){if(t.tree){var n,d;if(e.rowDropInParent){d=e.getRow(e.rowDropIn)}else{n=e.getRow(e.rowDropIn);d=e.getParent(n)}e.appendRange(l,d,n,e.rowDropDir!="bottom");e.trigger("rowDragDrop",{rows:l,parent:d,near:n,after:e.rowDropDir=="bottom"})}else{e.moveRange(l,e.rowDropIn,e.rowDropDir=="bottom");e.trigger("rowDragDrop",{rows:l,parent:d,near:e.getRow(e.rowDropIn),after:e.rowDropDir=="bottom"})}e.rowDropIn=-1}e.rowDroptip.hide();this.set("cursor","default")}})}},_onRowOver:function(e,t){if(l.draggable.dragging)return;var i=this,r=this.options;var a=i.getRow(e);var o=t?"addClass":"removeClass";if(i.enabledFrozen())$(i.getRowObj(a,true))[o](r.mouseoverRowCssClass);$(i.getRowObj(a,false))[o](r.mouseoverRowCssClass)},_onMouseUp:function(e){var t=this,i=this.options;if(l.draggable.dragging){var r=t._getSrcElementByEvent(e);if(r.hcell&&r.column){t.trigger("dragdrop",[{type:"header",column:r.column,cell:r.hcell},e])}else if(r.row){t.trigger("dragdrop",[{type:"row",record:r.data,row:r.row},e])}}},_onMouseDown:function(e){var t=this,i=this.options},_onContextmenu:function(e){var t=this,i=this.options;var r=t._getSrcElementByEvent(e);if(r.row){if(i.whenRClickToSelect)t.select(r.data);if(t.hasBind("contextmenu")){return t.trigger("contextmenu",[{data:r.data,rowindex:r.data["__index"],row:r.row},e])}}else if(r.hcell){if(!i.allowHideColumn)return true;var l=$(r.hcell).attr("columnindex");if(l==undefined)return true;var a=e.pageX-t.body.offset().left+parseInt(t.body[0].scrollLeft);if(l==t.columns.length-1)a-=50;t.popup.css({left:a,top:t.gridheader.height()+1});t.popup.toggle();return false}},_onDblClick:function(e){var t=this,i=this.options;var r=t._getSrcElementByEvent(e);if(r.row){t.trigger("dblClickRow",[r.data,r.data["__id"],r.row])}},_onKeyDown:function(e){var t=this,i=this.options;if(i.excelMode){t.nearCells=t.nearCells||[];var r=e.keyCode||e.which||e.charCode;if(t.editor.editing&&!$.quiui.win.masking){if(r==37){if(t.nearCells[0]!=null){t.endEdit();t._applyEditor(t.nearCells[0])}}else if(r==39){if(t.nearCells[1]!=null){t.endEdit();t._applyEditor(t.nearCells[1])}}else if(r==38){if(t.nearCells[2]!=null){var l=Math.round(t.gridbody[0].scrollTop/(i.rowHeight+1))+1;if(t.nearCells[4]==l){t.setScroller(t.gridbody[0].scrollTop-i.rowHeight-1,null,false);setTimeout(function(){t.endEdit();t._applyEditor(t.nearCells[2])},100)}else{t.endEdit();t._applyEditor(t.nearCells[2])}}}else if(r==40){if(t.nearCells[3]!=null){var l=Math.round(t.gridbody[0].scrollTop/(i.rowHeight+1))+1;var a=Math.round(t.gridbody.height()/(i.rowHeight+1))+l-1;if(t.nearCells[4]==a){t.setScroller(t.gridbody[0].scrollTop+i.rowHeight+1,null,false);setTimeout(function(){t.endEdit();t._applyEditor(t.nearCells[3])},100)}else{t.endEdit();t._applyEditor(t.nearCells[3])}}}else if(r==45){t.trigger("insert")}else if(r==46){if(t.ctrlKey){t.trigger("delete",[t.nearCells[4]-1])}}}}},_onClick:function(e){var t=e.target||e.srcElement;var i=this,r=this.options;var l=i._getSrcElementByEvent(e);if(l.out){if(i.editor.editing&&!$.quiui.win.masking)i.endEdit();if(r.allowHideColumn)i.popup.hide();return}if(l.indetail){return}if(i.editor.editing){i.endEdit()}if(r.allowHideColumn){if(!l.popup){i.popup.hide()}}if(l.row&&r.detail&&r.detailClickExpand){var a=l.data;i.detailExtendRow=i.detailExtendRow||[];var o;o=$.inArray(a,i.detailExtendRow);if(o==-1){if(r.detailCloseOther){for(var n=0;n<i.detailExtendRow.length;n++){i.collapseDetail(i.detailExtendRow[n])}i.detailExtendRow=[]}i.extendDetail(a)}else{i.collapseDetail(a);if(o!=-1){i.detailExtendRow.splice(o,1)}}}if(l.checkboxall){var d=$(l.hrow);var s=d.hasClass("l-checked");if(i.trigger("beforeCheckAllRow",[!s,i.element])==false)return false;if(s){d.removeClass("l-checked")}else{d.addClass("l-checked")}i.selected=[];for(var u in i.records){if(s)i.unselect(i.records[u]);else i.select(i.records[u])}i.trigger("checkAllRow",[!s,i.element])}else if(l.hcelltext){var c=$(l.hcelltext).parent().parent();if(!r.enabledSort||!l.column)return;if(l.column.isSort==false)return;if(r.url&&i.isDataChanged)return;var h=$(".l-grid-hd-cell-sort:first",c);var f=l.column.name;if(!f)return;if(h.length>0){if(h.hasClass("l-grid-hd-cell-sort-asc")){h.removeClass("l-grid-hd-cell-sort-asc").addClass("l-grid-hd-cell-sort-desc");c.removeClass("l-grid-hd-cell-asc").addClass("l-grid-hd-cell-desc");i.changeSort(f,"desc")}else if(h.hasClass("l-grid-hd-cell-sort-desc")){h.removeClass("l-grid-hd-cell-sort-desc").addClass("l-grid-hd-cell-sort-asc");c.removeClass("l-grid-hd-cell-desc").addClass("l-grid-hd-cell-asc");i.changeSort(f,"asc")}}else{c.removeClass("l-grid-hd-cell-desc").addClass("l-grid-hd-cell-asc");$(l.hcelltext).after("<span class='l-grid-hd-cell-sort l-grid-hd-cell-sort-asc'>&nbsp;&nbsp;</span>");i.changeSort(f,"asc")}$(".l-grid-hd-cell-sort",i.gridheader).add($(".l-grid-hd-cell-sort",i.f.gridheader)).not($(".l-grid-hd-cell-sort:first",c)).remove()}else if(l.detailbtn&&r.detail){if(r.detailClickExpand){return}var a=l.data;var d=$([i.getRowObj(a,false)]);if(i.enabledFrozen())d=d.add(i.getRowObj(a,true));var u=a["__id"];i.detailExtendRow=i.detailExtendRow||[];var o;o=$.inArray(a,i.detailExtendRow);if($(l.detailbtn).hasClass("l-open")){if(r.detail.onCollapse)r.detail.onCollapse(a,$(".l-grid-detailpanel-inner:first",g)[0]);d.next("tr.l-grid-detailpanel").hide();$(l.detailbtn).removeClass("l-open");if(o!=-1)i.detailExtendRow.splice(o,1)}else{if(r.detailCloseOther){for(var n=0;n<i.detailExtendRow.length;n++){i.collapseDetail(i.detailExtendRow[n])}i.detailExtendRow=[]}var g=d.next("tr.l-grid-detailpanel");if(g.length>0){g.show();if(r.detail.onExtend)r.detail.onExtend(a,$(".l-grid-detailpanel-inner:first",g)[0]);$(l.detailbtn).addClass("l-open");if(o==-1)i.detailExtendRow.push(a);i.trigger("SysGridHeightChanged");return}$(l.detailbtn).addClass("l-open");var p=0;for(var m=0;m<i.columns.length;m++)if(i.columns[m].frozen)p++;var v=$("<tr class='l-grid-detailpanel'><td><div class='l-grid-detailpanel-inner' style='display:none'></div></td></tr>");var w=$("<tr class='l-grid-detailpanel'><td><div class='l-grid-detailpanel-inner' style='display:none'></div></td></tr>");v.attr("id",i.id+"|detail|"+u);i.detailrows=i.detailrows||[];i.detailrows.push(v[0]);i.detailrows.push(w[0]);i.detailExtendRow.push(a);var b=$("div:first",v);b.parent().attr("colSpan",i.columns.length-p);d.eq(0).after(v);if(p>0){w.find("td:first").attr("colSpan",p);d.eq(1).after(w)}if(r.detail.onShowDetail){r.detail.onShowDetail(a,b[0],function(){i.trigger("SysGridHeightChanged")});$("div:first",w).add(b).show().height(r.detail.height||r.detailHeight)}else if(r.detail.render){b.append(r.detail.render());b.show()}i.trigger("SysGridHeightChanged")}}else if(l.groupbtn){var C=$(l.grouprow);var _=true;if($(l.groupbtn).hasClass("l-grid-group-togglebtn-close")){$(l.groupbtn).removeClass("l-grid-group-togglebtn-close");if(C.hasClass("l-grid-grouprow-last")){$("td:first",C).width("auto")}}else{_=false;$(l.groupbtn).addClass("l-grid-group-togglebtn-close");if(C.hasClass("l-grid-grouprow-last")){$("td:first",C).width(i.gridtablewidth)}}var y=C.next(".l-grid-row,.l-grid-totalsummary-group,.l-grid-detailpanel");while(true){if(y.length==0)break;if(_){y.show();if(y.hasClass("l-grid-detailpanel")&&!y.prev().find("td.l-grid-row-cell-detail:first span.l-grid-row-cell-detailbtn:first").hasClass("l-open")){y.hide()}}else{y.hide()}y=y.next(".l-grid-row,.l-grid-totalsummary-group,.l-grid-detailpanel")}i.trigger("SysGridHeightChanged")}else if(l.treelink){if(r.treeAjax){var a=l.data;var d=i.getRow(a);if(i.hasChildren(d)){i.toggle(l.data)}else{$(l.treelink).addClass("l-grid-tree-link-loading");var x=r.treeChildDataPath;var D=r.treeAutoParam;var R=l.data[D];$.post(x+R,{},function(e){setTimeout(function(){var t;if(r.treeDataFilter){var o=r.treeDataFilter;if(typeof o=="function"){t=o.apply(null,[e])}}else{t=e}i.appendRange(t,d);a.open=true;i.toggle(l.data)},100)},"json")}}else{i.toggle(l.data)}}else if(l.row&&i.enabledCheckbox()){if(!l.checkbox){i.trigger("clickRow")}var k=r.selectRowButtonOnly?true:false;if(r.enabledEdit)k=true;if(l.checkbox||!k){var d=$(l.row);var s=d.hasClass("l-selected");if(i.trigger("beforeCheckRow",[!s,l.data,l.data["__id"],l.row])==false)return false;var E=s?"unselect":"select";i[E](l.data);if(r.tree&&r.autoCheckChildren){var z=i.getChildren(l.data,true);for(var m=0,S=z.length;m<S;m++){i[E](z[m])}}i.trigger("checkRow",[!s,l.data,l.data["__id"],l.row])}if(!l.checkbox&&l.cell&&r.enabledEdit&&r.clickToEdit){i._applyEditor(l.cell)}}else if(l.row&&!i.enabledCheckbox()){i.trigger("clickRow");if(l.cell&&r.enabledEdit&&r.clickToEdit){i._applyEditor(l.cell)}if(!r.noSelecton){if($(l.row).hasClass("l-selected")){if(!r.allowUnSelectRow){$(l.row).addClass("l-selected-again");return}i.unselect(l.data)}else{i.select(l.data)}}}else if(l.toolbar){if(l.first){if(i.trigger("toFirst",[i.element])==false)return false;i.changePage("first")}else if(l.prev){if(i.trigger("toPrev",[i.element])==false)return false;i.changePage("prev")}else if(l.next){if(i.trigger("toNext",[i.element])==false)return false;i.changePage("next")}else if(l.last){if(i.trigger("toLast",[i.element])==false)return false;i.changePage("last")}else if(l.load){if($("span",l.load).hasClass("l-disabled"))return false;if(i.trigger("reload",[i.element])==false)return false;i.loadData(r.where)}if(r.dataAction=="local"){$(".l-grid-hd-row").removeClass("l-checked")}}},select:function(e){var t=this,i=this.options;var r=t.getRow(e);var l=r["__id"];var a=t.getRowObj(l);var o=t.getRowObj(l,true);if(!t.enabledCheckbox()&&!t.ctrlKey){for(var n in t.selected){var d=t.selected[n];if(d["__id"]in t.records){$(t.getRowObj(d)).removeClass("l-selected l-selected-again");if(t.enabledFrozen())$(t.getRowObj(d,true)).removeClass("l-selected l-selected-again")}}t.selected=[]}if(a)$(a).addClass("l-selected");if(o)$(o).addClass("l-selected");t.selected[t.selected.length]=r;t.trigger("selectRow",[r,l,a])},unselect:function(e){var t=this,i=this.options;var r=t.getRow(e);var l=r["__id"];var a=t.getRowObj(l);var o=t.getRowObj(l,true);$(a).removeClass("l-selected l-selected-again");if(t.enabledFrozen())$(o).removeClass("l-selected l-selected-again");t._removeSelected(r);t.trigger("unSelectRow",[r,l,a])},isSelected:function(e){var t=this,i=this.options;var r=t.getRow(e);for(var l in t.selected){if(t.selected[l]==r)return true}return false},_onResize:function(){var e=this,t=this.options;e.resetHeight();e.resetWidth();e.trigger("SysGridHeightChanged")}});$.quiui.controls.Grid.prototype.enabledTotal=$.quiui.controls.Grid.prototype.isTotalSummary;$.quiui.controls.Grid.prototype.add=$.quiui.controls.Grid.prototype.addRow;$.quiui.controls.Grid.prototype.update=$.quiui.controls.Grid.prototype.updateRow;$.quiui.controls.Grid.prototype.append=$.quiui.controls.Grid.prototype.appendRow;$.quiui.controls.Grid.prototype.getSelected=$.quiui.controls.Grid.prototype.getSelectedRow;$.quiui.controls.Grid.prototype.getSelecteds=$.quiui.controls.Grid.prototype.getSelectedRows;$.quiui.controls.Grid.prototype.getCheckedRows=$.quiui.controls.Grid.prototype.getSelectedRows;$.quiui.controls.Grid.prototype.getCheckedRowObjs=$.quiui.controls.Grid.prototype.getSelectedRowObjs;$.quiui.controls.Grid.prototype.setOptions=$.quiui.controls.Grid.prototype.set})(jQuery);(function(e){e.fn.quiResizable=function(t){return e.quiui.run.call(this,"quiResizable",arguments,{idAttrName:"quiuiresizableid",hasElement:false,propertyToElemnt:"target"})};e.fn.quiGetResizableManager=function(){return e.quiui.run.call(this,"quiGetResizableManager",arguments,{idAttrName:"quiuiresizableid",hasElement:false,propertyToElemnt:"target"})};e.quiDefaults.Resizable={handles:"n, e, s, w, ne, se, sw, nw",maxWidth:2e3,maxHeight:2e3,minWidth:20,minHeight:20,scope:3,animate:false,onStartResize:function(e){},onResize:function(e){},onStopResize:function(e){},onEndResize:null};e.quiui.controls.Resizable=function(t){e.quiui.controls.Resizable.base.constructor.call(this,null,t)};e.quiui.controls.Resizable.quiExtend(e.quiui.core.UIComponent,{__getType:function(){return"Resizable"},__idPrev:function(){return"Resizable"},_render:function(){var t=this,i=this.options;t.target=e(i.target);t.set(i);t.target.mousemove(function(r){if(i.disabled)return;t.dir=t._getDir(r);if(t.dir)t.target.css("cursor",t.dir+"-resize");else if(t.target.css("cursor").indexOf("-resize")>0)t.target.css("cursor","default");if(i.target.quiuidragid){var l=e.quiui.get(i.target.quiuidragid);if(l&&t.dir){l.set("disabled",true)}else if(l){l.set("disabled",false)}}}).mousedown(function(e){if(i.disabled)return;if(t.dir){t._start(e)}})},_rendered:function(){this.options.target.quiuiresizableid=this.id},_getDir:function(t){var i=this,r=this.options;var l="";var a=i.target.offset();var o=i.target.width();var n=i.target.height();var d=r.scope;var s=t.pageX||t.screenX;var u=t.pageY||t.screenY;if(u>=a.top&&u<a.top+d){l+="n"}else if(u<=a.top+n&&u>a.top+n-d){l+="s"}if(s>=a.left&&s<a.left+d){l+="w"}else if(s<=a.left+o&&s>a.left+o-d){l+="e"}if(r.handles=="all"||l=="")return l;if(e.inArray(l,i.handles)!=-1)return l;return""},_setHandles:function(e){if(!e)return;this.handles=e.replace(/(\s*)/g,"").split(",")},_createProxy:function(){var t=this;t.proxy=e('<div class="l-resizable"></div>');t.proxy.width(t.target.width()).height(t.target.height());t.proxy.attr("resizableid",t.id).appendTo("body")},_removeProxy:function(){var e=this;if(e.proxy){e.proxy.remove();e.proxy=null}},_start:function(t){var i=this,r=this.options;i._createProxy();i.proxy.css({left:i.target.offset().left,top:i.target.offset().top,position:"absolute"});i.current={dir:i.dir,left:i.target.offset().left,top:i.target.offset().top,startX:t.pageX||t.screenX,startY:t.pageY||t.clientY,width:i.target.width(),height:i.target.height()};e(document).bind("selectstart.resizable",function(){return false});e(document).bind("mouseup.resizable",function(){i._stop.apply(i,arguments)});e(document).bind("mousemove.resizable",function(){i._drag.apply(i,arguments)});i.proxy.show();i.trigger("startResize",[i.current,t])},changeBy:{t:["n","ne","nw"],l:["w","sw","nw"],w:["w","sw","nw","e","ne","se"],h:["n","ne","nw","s","se","sw"]},_drag:function(e){var t=this,i=this.options;if(!t.current)return;if(!t.proxy)return;t.proxy.css("cursor",t.current.dir==""?"default":t.current.dir+"-resize");var r=e.pageX||e.screenX;var l=e.pageY||e.screenY;t.current.diffX=r-t.current.startX;t.current.diffY=l-t.current.startY;t._applyResize(t.proxy);t.trigger("resize",[t.current,e])},_stop:function(t){var i=this,r=this.options;if(i.hasBind("stopResize")){if(i.trigger("stopResize",[i.current,t])!=false)i._applyResize()}else{i._applyResize()}i._removeProxy();i.trigger("endResize",[i.current,t]);e(document).unbind("selectstart.resizable");e(document).unbind("mousemove.resizable");e(document).unbind("mouseup.resizable")},_applyResize:function(t){var i=this,r=this.options;var l={left:i.current.left,top:i.current.top,width:i.current.width,height:i.current.height};var a=false;if(!t){t=i.target;a=true;if(!isNaN(parseInt(i.target.css("top"))))l.top=parseInt(i.target.css("top"));else l.top=0;if(!isNaN(parseInt(i.target.css("left"))))l.left=parseInt(i.target.css("left"));else l.left=0}if(e.inArray(i.current.dir,i.changeBy.l)>-1){l.left+=i.current.diffX;i.current.diffLeft=i.current.diffX}else if(a){delete l.left}if(e.inArray(i.current.dir,i.changeBy.t)>-1){l.top+=i.current.diffY;i.current.diffTop=i.current.diffY}else if(a){delete l.top}if(e.inArray(i.current.dir,i.changeBy.w)>-1){l.width+=(i.current.dir.indexOf("w")==-1?1:-1)*i.current.diffX;i.current.newWidth=l.width}else if(a){delete l.width}if(e.inArray(i.current.dir,i.changeBy.h)>-1){l.height+=(i.current.dir.indexOf("n")==-1?1:-1)*i.current.diffY;i.current.newHeight=l.height}else if(a){delete l.height}if(a&&r.animate)t.animate(l);else t.css(l)}})})(jQuery);(function(e){e.fn.quiToolBar=function(t){return e.quiui.run.call(this,"quiToolBar",arguments)};e.fn.quiGetToolBarManager=function(){return e.quiui.run.call(this,"quiGetToolBarManager",arguments)};e.quiDefaults.ToolBar={};e.quiMethos.ToolBar={};e.quiui.controls.ToolBar=function(t,i){e.quiui.controls.ToolBar.base.constructor.call(this,t,i)};e.quiui.controls.ToolBar.quiExtend(e.quiui.core.UIComponent,{__getType:function(){return"ToolBar"},__idPrev:function(){return"ToolBar"},_extendMethods:function(){return e.quiMethos.ToolBar},_render:function(){var t=this,i=this.options;t.toolBar=e(this.element);t.toolBar.addClass("l-toolbar");t.set(i)},_setItems:function(t){var i=this,r=this.options;if(r.position=="right"){for(var l=e(t).length-1;l>=0;l--){i.addItem(e(t)[l])}}else{e(t).each(function(e,t){i.addItem(t)})}},addItem:function(t){var i=this,r=this.options;if(t.visible!=null&&t.visible==false){return}if(t.line){if(r.position=="right"||t.position=="right"){i.toolBar.append('<div class="l-bar-separator-right"></div>')}else{i.toolBar.append('<div class="l-bar-separator"></div>')}return}var l=e('<div class="l-panel-btn"><div class="l-panel-btn-l"></div><div class="l-panel-btn-r"></div></div>');if(r.position=="right"){l.addClass("l-toolbar-item-right")}else{if(t.position=="right"){l.addClass("l-toolbar-item-right")}else{l.addClass("l-toolbar-item")}}i.toolBar.append(l);t.id&&l.attr("toolbarid",t.id);var a;if(t.iconClass){var o=t.id;if(t.id==undefined)a=e("<div class='l-icon "+t.iconClass+"'></div>");else a=e("<div id='"+t.id+"' class='l-icon "+t.iconClass+"'></div>");a.css("float","left");l.append(a);l.addClass("l-toolbar-item-hasicon")}if(t.text){a.html(t.text)}if(t.disabled){l.css({color:"#999999",cursor:"default"});return}t.click&&l.click(function(){t.click(t)});l.hover(function(){e(this).addClass("l-panel-btn-over")},function(){e(this).removeClass("l-panel-btn-over")})}})})(jQuery);