/*!@license
 * Infragistics.Web.ClientUI Grid Column Summaries 21.2.12
 *
 * Copyright (c) 2011-2022 Infragistics Inc.
 *
 * http://www.infragistics.com/
 *
 * Depends on:
 *	jquery-1.9.1.js
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	infragistics.ui.widget.js
 *	infragistics.ui.grid.framework.js
 *	infragistics.ui.shared.js
 *	infragistics.dataSource.js
 *	infragistics.util.js
 *	infragistics.ui.grid.shared.js
 *	infragistics.ui.grid.featurechooser.js
 */
(function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.ui.grid.featurechooser"],factory)}else{return factory(jQuery)}})(function($){"use strict";$.widget("ui.igGridSummaries",$.ui.igWidget,{grid:null,css:{columnSummariesDropdown:"ui-iggrid-summaries-dialog",footerRowTextContainer:"ui-iggrid-summaries-footer-text-container",footerRowIconContainer:"ui-corner-all ui-iggrid-summaries-footer-icon-container",footerDropdownButtonsContainer:"ui-iggrid-summaries-footer-dialog-buttons-container",footerButtonIcon:"ui-icon ui-icon-calculator ui-iggrid-icon-summaries",footerButtonIconHover:"ui-iggrid-filterbuttonhover ui-state-hover",footerButtonIconActive:"ui-iggrid-filterbuttonactive ui-state-active",featureChooserIconClass:"ui-icon ui-iggrid-icon-summaries",dropDownListContainer:"ui-iggrid-summaries-dropdown-listcontainer ui-widget",dropDownListItem:"ui-iggrid-summaries-dialog-listitem",headerButtonContainer:"ui-iggrid-summaries-headerbuttoncontainer ui-corner-all",headerButtonIcon:"ui-iggrid-summaries-header-icon ui-corner-all ui-icon ui-icon-calculator ui-icon-summaries",headerButtonIconHover:"ui-iggrid-summaries-header-icon-hover ui-state-hover",footerRowCell:"ui-widget-footer ui-state-default",footerRowCellHover:"ui-state-hover",checkbox:"ui-state-default ui-corner-all ui-igcheckbox-normal",checkboxOff:"ui-icon ui-icon-check ui-igcheckbox-normal-off",checkboxOn:"ui-icon ui-icon-check ui-igcheckbox-normal-on",checkboxHovered:"ui-state-hover",footerRowIconContainerEmpty:"ui-iggrid-summaries-footer-icon-container-empty",footerRowTextContainerEmpty:"ui-iggrid-summaries-footer-text-container-empty",baseClassIE7:"ui-ie7"},defaultSummaryMethods:null,renderInFeatureChooser:true,options:{type:null,dialogButtonOKText:null,dialogButtonCancelText:null,featureChooserText:null,featureChooserTextHide:null,emptyCellText:null,summariesHeaderButtonTooltip:null,calculateRenderMode:"okcancelbuttons",compactRenderingMode:true,showSummariesButton:true,summariesResponseKey:"summaries",summaryExprUrlKey:"summaries",callee:null,dropDownHeight:"",dropDownWidth:"",showDropDownButton:true,summaryExecution:"afterfilteringbeforepaging",dropDownDialogAnimationDuration:400,resultTemplate:"{0} = {1}",renderSummaryCellFunc:null,columnSettings:[{allowSummaries:true,columnKey:null,columnIndex:-1,summaryOperands:[{rowDisplayLabel:"",type:"custom",active:true,summaryCalculator:null,order:5,format:undefined}]}],inherit:false,locale:{dialogButtonOKText:undefined,dialogButtonCancelText:undefined,featureChooserText:undefined,featureChooserTextHide:undefined,emptyCellText:undefined,summariesHeaderButtonTooltip:undefined}},events:{dropDownOpening:"dropDownOpening",dropDownOpened:"dropDownOpened",dropDownClosing:"dropDownClosing",dropDownClosed:"dropDownClosed",summariesCalculating:"summariesCalculating",summariesCalculated:"summariesCalculated",summariesMethodSelectionChanged:"summariesMethodSelectionChanged",summariesToggling:"summariesToggling",summariesToggled:"summariesToggled",dropDownOKClicked:"dropDownOKClicked",dropDownCancelClicked:"dropDownCancelClicked"},_initDefaultSummaryMethods:function(){this.defaultSummaryMethods=this.defaultSummaryMethods||[{rowDisplayLabel:this._getLocaleValue("defaultSummaryRowDisplayLabelCount"),type:"count",allowed:"all",active:true,order:0},{rowDisplayLabel:this._getLocaleValue("defaultSummaryRowDisplayLabelMin"),type:"min",allowed:["number","date","time","numeric"],active:true,order:1},{rowDisplayLabel:this._getLocaleValue("defaultSummaryRowDisplayLabelMax"),type:"max",allowed:["number","date","time","numeric"],active:true,order:2},{rowDisplayLabel:this._getLocaleValue("defaultSummaryRowDisplayLabelSum"),type:"sum",allowed:["number","numeric"],active:true,order:3},{rowDisplayLabel:this._getLocaleValue("defaultSummaryRowDisplayLabelAvg"),type:"avg",allowed:["number","numeric"],active:true,order:4},{rowDisplayLabel:this._getLocaleValue("defaultSummaryRowDisplayLabelCustom"),type:"custom",allowed:"all",active:true,summaryCalculator:null,order:5}]},_createWidget:function(){this.options.columnSettings=[];this._summariesRows=[];this._data={};this._currentOpenedColumnKey=null;this._isRenderedSummariesRows=false;this._footerInitialized=false;this._currentRowShownIcons=null;this._customInitMethods=[];this._fcData={};this._isInitFC=false;this._isSummariesRowsHidden=false;this._disallowedSummaries=[];$.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){this._initDefaultSummaryMethods();var compactRenderingMode=this.options.compactRenderingMode;this._setRenderSummaryCellFunction(this.options.renderSummaryCellFunc);if(compactRenderingMode==="true"){compactRenderingMode=true}else if(compactRenderingMode==="false"){compactRenderingMode=false}this.options.compactRenderingMode=compactRenderingMode},changeGlobalLanguage:function(){},changeGlobalRegional:function(){},_setRenderSummaryCellFunction:function(func){if(func&&$.type(func)!=="function"){if(window[func]&&typeof window[func]==="function"){func=window[func]}}if(func&&$.type(func)==="function"){this._renderCellHandler=func}else{this._renderCellHandler=$.proxy(this._renderCell,this)}},_initColumnSettings:function(){var settings=[],i,j,k,l,cs=$.extend(true,[],this.options.columnSettings),csetting,columnSettingsLength=cs.length,gridColumnsLength=this.grid.options.columns?this.grid.options.columns.length:0;this.grid.dataSource.settings.summaries.calculateAll=false;this.newColumnSettings=[];this._disallowedSummaries=[];for(i=0;i<gridColumnsLength;i++){settings.push({columnIndex:i,columnKey:this.grid.options.columns[i].key,dataType:this.grid.options.columns[i].dataType})}if(columnSettingsLength>0){for(i=0;i<columnSettingsLength;i++){csetting=cs[i];if(csetting.summaryOperands===null||csetting.summaryOperands===undefined){continue}if(csetting.columnKey!==null&&csetting.columnKey!==undefined||csetting.columnIndex!==null&&csetting.columnIndex!==undefined){for(j=0;j<gridColumnsLength;j++){for(l=0;l<csetting.summaryOperands.length;l++){if(csetting.summaryOperands[l].active===null||csetting.summaryOperands[l].active===undefined){csetting.summaryOperands[l].active=true}if(csetting.summaryOperands[l].type.startsWith("custom")===true){if(csetting.summaryOperands[l].type!=="custom"){for(k=0;k<this._customInitMethods.length;k++){if(csetting.summaryOperands[l].summaryCalculator===this._customInitMethods[k].summaryCalculator){break}}if(this._customInitMethods.length===k){this._customInitMethods.push({summaryCalculator:csetting.summaryOperands[l].summaryCalculator,type:csetting.summaryOperands[l].type,index:csetting.summaryOperands[l].type.replace("custom","")})}}}}}}}for(i=0;i<columnSettingsLength;i++){csetting=cs[i];if(csetting.columnKey!==null&&csetting.columnKey!==undefined||csetting.columnIndex!==null&&csetting.columnIndex!==undefined){for(j=0;j<gridColumnsLength;j++){if(settings[j].columnIndex===csetting.columnIndex&&csetting.columnIndex!==undefined&&csetting.columnIndex!==null||settings[j].columnKey===csetting.columnKey&&csetting.columnKey!==undefined&&csetting.columnKey!==null){csetting.dataType=settings[j].dataType;csetting.columnIndex=settings[j].columnIndex;csetting.columnKey=settings[j].columnKey;csetting.summaryOperands=this._initAllowedSummaryMethods(csetting);if(csetting.allowSummaries!==false){this.newColumnSettings.push(csetting)}else{this._disallowedSummaries[settings[j].columnKey]=true}break}}}}for(i=0;i<gridColumnsLength;i++){for(j=0;j<this.newColumnSettings.length;j++){if(this.newColumnSettings[j].columnKey===settings[i].columnKey){break}}if(j===this.newColumnSettings.length&&this._disallowedSummaries[settings[i].columnKey]!==true){this.newColumnSettings.push({dataType:settings[i].dataType,columnIndex:i,columnKey:settings[i].columnKey,summaryOperands:this._initAllowedSummaryMethods(settings[i],false)})}}}else{for(i=0;i<gridColumnsLength;i++){this.newColumnSettings.push({dataType:settings[i].dataType,columnIndex:i,columnKey:settings[i].columnKey,summaryOperands:this._initAllowedSummaryMethods(settings[i])})}if(!gridColumnsLength&&this.grid.options.autoGenerateColumns&&this.options.type==="remote"){this.grid.dataSource.settings.summaries.calculateAll=true}}this.columnSettings=this.newColumnSettings},_initAllowedSummaryMethods:function(column,isNotActive){var i,j,k,z,c,lastCustomSummaryOperandIndex,defaultSummaryMethodsLength=this.defaultSummaryMethods.length,columnDataType,methods=[],allowedMethods=[],methodName,methodsLength,isActive,defaultMethodName;if(column===null||column===undefined){return}columnDataType=column.dataType;if(columnDataType==="object"){columnDataType=this.grid.dataSource._getFieldTypeFromSchema(column.columnKey)}if(column!==null&&column!==undefined&&column.summaryOperands!==undefined&&column.summaryOperands!==null){for(i=0;i<column.summaryOperands.length;i++){if(column.summaryOperands[i].type===undefined||column.summaryOperands[i].type===null){return}methodName=column.summaryOperands[i].type.toLowerCase();if(this._isAllowedMethodName(methodName)===true){if(isNotActive===true){column.summaryOperands[i].active=false}if(column.summaryOperands[i].type==="custom"){if(column.summaryOperands[i].summaryCalculator===null||column.summaryOperands[i].summaryCalculator===undefined){continue}lastCustomSummaryOperandIndex=1;for(k=0;k<this._customInitMethods.length;k++){if(column.summaryOperands[i].summaryCalculator===this._customInitMethods[k].summaryCalculator){column.summaryOperands[i].type=this._customInitMethods[k].type;break}if(this._customInitMethods[k].index>lastCustomSummaryOperandIndex){lastCustomSummaryOperandIndex=this._customInitMethods[k].index}}if(this._customInitMethods.length===k){lastCustomSummaryOperandIndex++;column.summaryOperands[i].type="custom"+lastCustomSummaryOperandIndex;this._customInitMethods.push({summaryCalculator:column.summaryOperands[i].summaryCalculator,type:"custom"+lastCustomSummaryOperandIndex,index:lastCustomSummaryOperandIndex})}}methods.push(column.summaryOperands[i])}}}else{for(i=0;i<defaultSummaryMethodsLength;i++){c=this.defaultSummaryMethods[i];if(c.type.startsWith("custom")){continue}isActive=c.active;if(isNotActive===true){isActive=false}methods.push({rowDisplayLabel:c.rowDisplayLabel,type:c.type,allowed:c.allowed,active:isActive,order:c.order,format:c.format})}}methodsLength=methods.length;for(i=0;i<methodsLength;i++){for(j=0;j<defaultSummaryMethodsLength;j++){defaultMethodName=this.defaultSummaryMethods[j].type.toUpperCase();if(defaultMethodName===methods[i].type.toUpperCase()||methods[i].type.startsWith("custom")){if(methods[i].type.toLowerCase().startsWith("custom")){if(methods[i].order<this.defaultSummaryMethods[j].order){methods[i].order=this.defaultSummaryMethods[j].order}}else if(methods[i].order!==this.defaultSummaryMethods[j].order){methods[i].order=this.defaultSummaryMethods[j].order}if(methods[i].rowDisplayLabel===null||methods[i].rowDisplayLabel===undefined){methods[i].rowDisplayLabel=this.defaultSummaryMethods[j].rowDisplayLabel}if(this.defaultSummaryMethods[j].allowed==="all"){allowedMethods.push(methods[i])}else{for(z=0;z<this.defaultSummaryMethods[j].allowed.length;z++){if(this.defaultSummaryMethods[j].allowed[z]===columnDataType){allowedMethods.push(methods[i]);break}}}break}}}return allowedMethods},changeLocale:function(){var fc=this.grid.element.data("igGridFeatureChooser"),self=this,$container=this.grid._rootContainer(),cols;if(fc&&this.renderInFeatureChooser){this._fcData={};fc._removeFeature("Summaries");this._initFC()}this.defaultSummaryMethods=null;this._initDefaultSummaryMethods();$container.find("[data-localeid=summariesHeaderButtonTooltip]").each(function(){self._changeLocaleForElement($(this))});cols=this.grid.options.columns;cols.forEach(function(col){this._updateColumnSettings(col.key);if(!this._isSummariesRowsHidden&&!col.hidden){this._updateDataLabels(col.key);this._renderFooterColumnInfo(col.key,this.summariesFor(col.key))}this._renderDropDown(col.key)},this)},changeRegional:function(){var cols=this.grid._getAllFormattedColumns();cols.forEach(function(col){this._renderFooterColumnInfo(col.key,this.summariesFor(col.key))},this)},_registerWidget:$.noop,_unregisterWidget:$.noop,_setOption:function(key,value){var i,o=this.options,columns,columnsLength,cs,csLength,$colCell,columnKey,gridId=this.grid.element[0].id;switch(key){case"calculateRenderMode":if(o.calculateRenderMode!==value){o.calculateRenderMode=value;columns=this.grid.options.columns;columnsLength=columns.length;for(i=0;i<columnsLength;i++){this._renderDropDown(columns[i].key)}}break;case"compactRenderingMode":if(o.compactRenderingMode!==value){o.compactRenderingMode=value;this._clearAllRows();this.calculateSummaries()}break;case"showSummariesButton":if(o.showSummariesButton!==value){o.showSummariesButton=value;cs=this.columnSettings;csLength=cs.length;for(i=0;i<csLength;i++){columnKey=cs[i].columnKey;if(value===true){$colCell=this.grid._rootContainer().find("#"+gridId+"_"+columnKey);if(this._fcData!==null&&this._fcData!==undefined&&$colCell.length>0&&this._fcData[columnKey]!==true){this._renderHeaderCellButton($colCell,columnKey)}}else{this.grid._rootContainer().find("#"+this._id("summaries","header_column_icon",columnKey)).remove()}}}break;case"disabled":if(o.disabled!==value){o.disabled=value;if(value===true){this._clearAllRows()}else{this.calculateSummaries()}}break;case"type":if(o.type!==value){o.type=value;this._setDataSourceColumnSettingsOptions()}break;case"summaryExprUrlKey":if(o.summaryExprUrlKey!==value){o.summaryExprUrlKey=value;this._setDataSourceColumnSettingsOptions()}break;case"dropDownHeight":if(o.dropDownHeight!==value){o.dropDownHeight=value;columns=this.grid.options.columns;columnsLength=columns.length;for(i=0;i<columnsLength;i++){this.grid._rootContainer().find("#"+this._id("summaries","methods_dialog",columns[i].key)).css("height",value)}}break;case"dropDownWidth":if(o.dropDownWidth!==value){o.dropDownWidth=value;columns=this.grid.options.columns;columnsLength=columns.length;for(i=0;i<columnsLength;i++){this.grid._rootContainer().find("#"+this._id("summaries","methods_dialog",columns[i].key)).css("width",value)}}break;case"showDropDownButton":if(o.showDropDownButton!==value){o.showDropDownButton=value;if(value===true){this._renderFooterIcons()}else{this._clearFooterIcons()}}break;case"resultTemplate":if(o.resultTemplate!==value){o.resultTemplate=value;this._clearAllRows();this.calculateSummaries()}break;case"columnSettings":if(o.columnSettings!==value){o.columnSettings=value;this.columnSettings=[];this.newColumnSettings=[];this._data={};this._clearAllRows();this._initColumnSettings();columns=this.grid.options.columns;columnsLength=columns.length;this.grid.dataSource.dataBind();for(i=0;i<columnsLength;i++){this._renderDropDown(columns[i].key)}}break;case"renderSummaryCellFunc":if(o.renderSummaryCellFunc!==value){this._setRenderSummaryCellFunction(value)}break}this._superApply(arguments)},_removeHeaderColumnIcons:function(){var i,cs=this.columnSettings,csLength=cs.length;for(i=0;i<csLength;i++){this.grid._rootContainer().find("#"+this._id("summaries","header_column_icon",cs[i].columnKey)).remove()}},destroy:function(){var i,columns,columnsLength,fc;this._detachEvents();this._clearAllRows();this.newColumnSettings=null;this.options=null;this._summariesRows=null;if(this._activeDialog){this._activeDialog.remove();this._activeDialog=null}this._data=null;this._currentOpenedColumnKey=null;this._isRenderedSummariesRows=null;this._footerInitialized=null;this._currentRowShownIcons=null;this._customInitMethods=null;this._fcData=null;this._isInitFC=null;this._isSummariesRowsHidden=null;this._disallowedSummaries=null;this._activeDialog=null;this.defaultSummaryMethods=null;columns=this.grid.options.columns;columnsLength=columns.length;for(i=0;i<columnsLength;i++){this.grid._rootContainer().find("#"+this._id("summaries","methods_dialog",columns[i].key)).remove()}fc=this.grid.element.data("igGridFeatureChooser");if(fc&&this.renderInFeatureChooser){fc._removeFeature("Summaries")}this._superApply(arguments);return this},_detachEvents:function(){this.grid.footersTable().find("tr:first td").unbind(".summaries");if(this._headerRenderedHandler){this.grid.element.unbind("iggridheaderrendered",this._headerRenderedHandler)}if(this._footerRenderedHandler){this.grid.element.unbind("iggridfooterrendered",this._footerRenderedHandler)}if(this._headerCellRenderedHandler){this.grid.element.unbind("iggridheadercellrendered",this._headerCellRenderedHandler)}if(this._headerFooterInitHandler){this.grid.element.unbind("iggridheaderextracellsmodified",this._headerFooterInitHandler)}if(this._columnsCollectionModifiedHandler){this.grid.element.unbind("iggridcolumnscollectionmodified",this._columnsCollectionModifiedHandler)}if(this._virtualHorizontalScrollHandler){this.grid.element.unbind("iggridvirtualhorizontalscroll",this._virtualHorizontalScrollHandler)}},_headerCellRendered:function(event,ui){if(ui.owner.element.attr("id")!==this.grid.element.attr("id")){return}if(this._isInitFC!==true){this._initFC()}},_initFC:function(){var i,fc,o=this.options,cs=this.columnSettings,csLength=cs.length,columnKey;this._isInitFC=true;fc=this.grid.element.data("igGridFeatureChooser");if(fc!==null&&fc!==undefined&&this.renderInFeatureChooser&&o.showSummariesButton){for(i=0;i<csLength;i++){if(cs[i].allowSummaries===false){continue}columnKey=cs[i].columnKey;if(fc._shouldRenderInFeatureChooser(columnKey)===true){fc._renderInFeatureChooser(columnKey,{name:"Summaries",text:this._getLocaleValue("featureChooserText"),textHide:this._getLocaleValue("featureChooserTextHide"),iconClass:this.css.featureChooserIconClass,iconClassOff:this.css.featureChooserIconClass,isSelected:!this._isSummariesRowsHidden,method:$.proxy(this._togglefromfc,this),updateOnClickAll:true,order:1,groupName:"toggle",groupOrder:1,type:"toggle",state:this._isSummariesRowsHidden?"show":"hide"});this._fcData[columnKey]=true}}}},_footerRendered:function(sender,args){if(args.owner.element.attr("id")!==this.grid.element.attr("id")){return}this._initColumnSettings();var i,cs=this.columnSettings,csLength=cs.length,columnKey;for(i=0;i<csLength;i++){if(cs[i].allowSummaries===false){continue}columnKey=cs[i].columnKey;this._renderDropDown(columnKey)}},_headerRendered:function(sender,args){if(args.owner.element.attr("id")!==this.grid.element.attr("id")){return}var i,cs=this.columnSettings,csLength=cs.length,$colCell,columnKey,gridId=this.grid.element[0].id;for(i=0;i<csLength;i++){if(cs[i].allowSummaries===false){continue}columnKey=cs[i].columnKey;$colCell=this.grid.headersTable().find("#"+gridId+"_"+columnKey);if($colCell.length>0&&this._fcData[columnKey]!==true&&this.options.showSummariesButton!==false){this._renderHeaderCellButton($colCell,columnKey)}}},_columnMap:function(){var o=this.options,cs=this.newColumnSettings,i,csLength=cs.length,elem,result=[];if(o.showSummariesButton===false){return false}for(i=0;i<csLength;i++){elem={columnKey:cs[i].columnKey,enabled:true};if(cs[i].allowSummaries===false){elem.enabled=false}result.push(elem)}return result},_dataRendered:function(){var grid=this.grid,padding;if(this.options.disabled!==true&&this._isSummariesRowsHidden===false){this._clearAllRows();this.calculateSummaries();if(!grid._initialized){if(!grid.options.fixedFooters){padding=parseFloat(grid.element.find("tbody > tr:first > :last-child").css(grid._padding));if(padding){grid._increaseLastCellVScrollbarPadding(grid.element,"tfoot","td",padding)}}if(this._isVirtualization()&&grid.options.virtualizationMode==="fixed"){grid._resetVirtualDom();grid._renderVirtualRecordsFixed()}}else{if(this._isVirtualization()){this.grid._synchronizeHScroll()}}}},_updatingApplied:function(){if(this.grid.options.autoCommit&&this._isRenderedSummariesRows){this.calculateSummaries()}},_rowDeleted:function(){this._updatingApplied()},_rowAdded:function(){this._updatingApplied()},_internalRowUpdated:function(){this._updatingApplied()},_internalCellUpdated:function(){this._updatingApplied()},isSummariesRowsHidden:function(){return this._isSummariesRowsHidden},calculateSummaries:function(){var h=this.grid.footersTable().outerHeight();this._trigger(this.events.rowsInitialize,null,{});this._calculateInternalSummaries();if(this.options.showDropDownButton===true){this._renderFooterIcons()}this._adjustHeights(h)},_adjustHeights:function(h){var grid=this.grid,gridHeight=grid.options.height;if(gridHeight===null||gridHeight===undefined){return}grid._fireInternalEvent("_summariesHeightsAdjusting");if(grid.hasFixedColumns()){this._syncFixedUnfixedRowHeights()}if(!h||h!==this.grid.footersTable().outerHeight()){grid._initializeHeights();if(this._isVirtualization()){var svst=this.grid._persistVirtualScrollTop;this.grid._persistVirtualScrollTop=true;this.grid._saveFirstVisibleTRIndex();grid._resetVirtualDom();grid._renderVirtualRecords();this.grid._persistVirtualScrollTop=svst}}if(grid.hasVerticalScrollbar()!==grid._hasVerticalScrollbar){grid._adjustLastColumnWidth(false)}},_removeFooterRows:function(){var i,sr=this._summariesRows,hasFixedColumns=this.grid.hasFixedColumns(),srLength=sr.length;for(i=0;i<srLength;i++){this.grid._rootContainer().find("#"+this._id("summaries","footer_row",sr[i].type)).remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+this._id("summaries","footer_row",sr[i].type,"fixed")).remove()}}this._isRenderedSummariesRows=false;this._summariesRows=[]},_calculateSelectedSummaries:function(columnKey){var i,k,methods,hasFixedColumns=this.grid.hasFixedColumns(),res=[],csLength,$checkbox,methodsLength,summariesRowsLength,isToCalculate=false,data,newMax,max,cs=null,isChecked,j,compactRenderingMode=this.options.compactRenderingMode,selectedColumnSettingsIndex,columnSettingsLength=this.columnSettings.length,isToRerender=false,isToRemoveRow=false,methodNameToRemove,unactiveMethods=[],unactiveMethodsLength=0,activeMethods=[],isToRemoveFirstRow=false,elemDataCalculating,rowToRemoveMethodName="";if(columnKey===undefined||columnKey===null){return}for(j=0;j<columnSettingsLength;j++){if(this.columnSettings[j].columnKey===columnKey&&this._isVisibleColumn(columnKey)){cs=this.columnSettings[j];selectedColumnSettingsIndex=j;break}}if(cs===null||cs===undefined){return}methods=cs.summaryOperands;methodsLength=methods.length;for(i=0;i<methodsLength;i++){$checkbox=this.grid._rootContainer().find("#"+this._id("summaries_footer_checkbox",methods[i].type.toLowerCase(),columnKey));isChecked=$checkbox.attr("data-chk").toLowerCase()==="on";if(isChecked!==methods[i].active){isToRerender=true;this.newColumnSettings[selectedColumnSettingsIndex].summaryOperands[i].active=isChecked;if(isChecked===true){isToCalculate=true;activeMethods.push(this.newColumnSettings[selectedColumnSettingsIndex].summaryOperands[i])}else{unactiveMethods.push(methods[i])}}}this.columnSettings[selectedColumnSettingsIndex].summaryOperands=this.newColumnSettings[selectedColumnSettingsIndex].summaryOperands;this.isToCalculateInRemoteMode=false;if(this.options.compactRenderingMode==="auto"){if(this._summariesRows.length===1&&this._analyzeAutoCompactRenderingMode()===false){this.grid._rootContainer().find("#"+this._summariesRows[0].id).remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+this._summariesRows[0].id+"_fixed").remove()}this._summariesRows=[];this.calculateSummaries();return}if(this._summariesRows.length>1&&this._analyzeAutoCompactRenderingMode()===true){for(i=0;i<this._summariesRows.length;i++){this.grid._rootContainer().find("#"+this._summariesRows[i].id).remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+this._summariesRows[i].id+"_fixed").remove()}}this._summariesRows=[];this.calculateSummaries();return}}if(isToCalculate===true){if((compactRenderingMode===false||compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===false)&&this._summariesRows.length===1){rowToRemoveMethodName=this._summariesRows[0].type.toLowerCase();isToRemoveFirstRow=true;for(j=0;j<this.columnSettings.length;j++){if(!this._isVisibleColumn(this.columnSettings[j].columnKey)){continue}for(k=0;k<this.columnSettings[j].summaryOperands.length;k++){if(this.columnSettings[j].summaryOperands[k].type.toLowerCase()===rowToRemoveMethodName&&this.columnSettings[j].summaryOperands[k].active!==false){isToRemoveFirstRow=false;break}}if(isToRemoveFirstRow===false){break}}}if(this.options.type==="remote"){if(this.options.calculateRenderMode==="onselect"){this.isToCalculateInRemoteMode=true;elemDataCalculating={type:activeMethods[0].type,result:"calculating",rowDisplayLabel:activeMethods[0].rowDisplayLabel,order:activeMethods[0].order,format:activeMethods[0].format,dataType:this.newColumnSettings[selectedColumnSettingsIndex].dataType};if(this._data[columnKey]===null||this._data[columnKey]===undefined){this._data[columnKey]=[]}this._data[columnKey].push(elemDataCalculating);this._renderFooterColumnInfo(columnKey,this._data[columnKey])}else{this._setDataSourceColumnSettingsOptions();this.grid.dataSource.dataBind()}}else{data=this._dataSummaries();if(this._trigger(this.events.summariesCalculating,null,{owner:this})!==false){res=this.calculateSummaryColumn(columnKey,activeMethods,data,this.newColumnSettings[selectedColumnSettingsIndex].dataType);if(compactRenderingMode===false||compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===false){this._renderFooterColumnInfo(columnKey,res)}this._trigger(this.events.summariesCalculated,null,{data:data,owner:this})}}}unactiveMethodsLength=unactiveMethods.length;if(compactRenderingMode===true||compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===true){cs=this.newColumnSettings;csLength=cs.length;max=0;newMax=0;if(compactRenderingMode==="auto"){unactiveMethods=[];for(i=0;i<methodsLength;i++){$checkbox=this.grid._rootContainer().find("#"+this._id("summaries_footer_checkbox",methods[i].type.toLowerCase(),columnKey));isChecked=$checkbox.attr("data-chk").toLowerCase()==="on";if(isChecked===false){unactiveMethods.push(methods[i])}}unactiveMethodsLength=unactiveMethods.length}for(i=0;i<unactiveMethodsLength;i++){this._removeDataResult(columnKey,unactiveMethods[i].type.toLowerCase())}if(unactiveMethodsLength>activeMethods.length){for(i=0;i<csLength;i++){if(!this._isVisibleColumn(cs[i].columnKey)){continue}newMax=0;for(j=0;j<cs[i].summaryOperands.length;j++){if(cs[i].summaryOperands[j].active===true){newMax++}}if(newMax>max){max=newMax}}summariesRowsLength=this._summariesRows.length;if(max>summariesRowsLength){return}for(i=0;i<max;i++){this.grid._rootContainer().find("#"+this._id("summaries","footer_row_text_container",this._summariesRows[i].type.toLowerCase(),columnKey)).attr("data-localeid","emptyCellText").html(this._getLocaleValue("emptyCellText"))}for(i=max;i<summariesRowsLength;i++){this.grid._rootContainer().find("#"+this._summariesRows[i].id).remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+this._summariesRows[i].id+"_fixed").remove()}}for(i=max;i<summariesRowsLength;i++){this._summariesRows.pop()}if(hasFixedColumns&&this.grid.options.height===null&&$.ig.util.isIE&&$.ig.util.browserVersion>=9){this._getColumnFixingInstance()._syncTableHeights()}}else if(activeMethods.length>unactiveMethodsLength){this._initCompactModeSummariesRows()}this._renderFooterColumnInfo(columnKey,this._data[columnKey]);if(this._summariesRows.length===0){this._insertSummariesRows(this.defaultSummaryMethods[0].type.toLowerCase(),this.defaultSummaryMethods[0].order);this._renderFooterIcons()}this._adjustHeights()}if(isToRerender&&(compactRenderingMode===false||compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===false)){for(i=0;i<unactiveMethodsLength;i++){methodNameToRemove=unactiveMethods[i].type.toLowerCase();this.grid._rootContainer().find("#"+this._id("summaries","footer_row_text_container",methodNameToRemove,columnKey)).attr("data-localeid","emptyCellText").html(this._getLocaleValue("emptyCellText"));this._removeDataResult(columnKey,methodNameToRemove);if(this._summariesRows.length<=1){continue}isToRemoveRow=true;for(j=0;j<this.columnSettings.length;j++){if(!this._isVisibleColumn(this.columnSettings[j].columnKey)){continue}for(k=0;k<this.columnSettings[j].summaryOperands.length;k++){if(this.columnSettings[j].summaryOperands[k].type.toLowerCase()===methodNameToRemove&&this.columnSettings[j].summaryOperands[k].active!==false){isToRemoveRow=false;break}}if(isToRemoveRow===false){break}}if(isToRemoveRow===true&&this._summariesRows.length>1){this._removeRowsDataByType(methodNameToRemove);this.grid._rootContainer().find("#"+this._id("summaries","footer_row",methodNameToRemove)).remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+this._id("summaries","footer_row",methodNameToRemove,"fixed")).remove()}}}if(this._summariesRows.length>=1&&isToRemoveFirstRow===true){for(i=0;i<activeMethods.length;i++){if(activeMethods[i].type.toLowerCase()===rowToRemoveMethodName){break}}if(i===activeMethods.length){this._removeRowsDataByType(rowToRemoveMethodName);this.grid._rootContainer().find("#"+this._id("summaries","footer_row",rowToRemoveMethodName)).remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+this._id("summaries","footer_row",rowToRemoveMethodName,"fixed")).remove()}}}if(this._summariesRows.length>0&&this.grid._rootContainer().find("#"+this._id("summaries","footer_row_button_dd",this._summariesRows[0].type,columnKey)).length===0){this._renderFooterIcons()}this._adjustHeights()}},_analyzeAutoCompactRenderingMode:function(){var i,j,methods,cs,methodsLength,activeMethodsCount,columnSettingsLength=this.columnSettings.length;for(j=0;j<columnSettingsLength;j++){cs=this.columnSettings[j];methods=cs.summaryOperands;methodsLength=methods.length;activeMethodsCount=0;for(i=0;i<methodsLength;i++){if(methods[i].active===true&&++activeMethodsCount>1){return false}}}return true},_removeRowsDataByType:function(methodNameToRemove){if(methodNameToRemove===undefined||methodNameToRemove===null){return}var hasFixedColumns=this.grid.hasFixedColumns(),self=this;this._summariesRows=$.grep(this._summariesRows,function(n){if(n.type===methodNameToRemove){$(n).remove();if(hasFixedColumns){self.grid.container().find("#"+n.id+"_fixed").remove()}}return n.type!==methodNameToRemove})},_syncFixedUnfixedRowHeights:function(){var $tfoot=this.grid.footersTable().find("tfoot"),$fixedTFoot=this.grid.fixedFootersTable().find("tfoot"),summariesRows=$tfoot.find("tr[ data-role ]"),fixedSummariesRows=$fixedTFoot.find("tr[ data-role ]"),$fixedRow;$.each(summariesRows,function(index,r){var h,fixedRowHeight,rowHeight,$row=$(r);$fixedRow=fixedSummariesRows.eq(index);if($fixedRow.length===0){return true}fixedRowHeight=$fixedRow.height();rowHeight=$row.height();if(fixedRowHeight>rowHeight){h=fixedRowHeight}else{h=rowHeight}$row.height(h);$fixedRow.height(h)})},_clearFooterIcons:function(){var i,currentRow=this._currentRowShownIcons,columns,columnsLength;if(currentRow===null||currentRow===undefined){return}columns=this.grid.options.columns;columnsLength=columns.length;for(i=0;i<columnsLength;i++){this.grid._rootContainer().find("#"+this._id("summaries","footer_row_button_dd",currentRow.type,columns[i].key)).remove()}},clearAllFooterIcons:function(){var i,j,rows=this._summariesRows,rowsLength=rows.length,columns=this.grid.options.columns,columnsLength=columns.length;for(i=0;i<rowsLength;i++){for(j=0;j<columnsLength;j++){this.grid._rootContainer().find("#"+this._id("summaries","footer_row_button_dd",rows[i].type,columns[j].key)).remove()}}},_clearAllRows:function(){var i,summaryRowsLength,hasFixedColumns=this.grid.hasFixedColumns(),$row;if(!this._summariesRows){return}summaryRowsLength=this._summariesRows.length;for(i=0;i<summaryRowsLength;i++){$row=this.grid._rootContainer().find("#"+this._summariesRows[i].id);$row.remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+this._summariesRows[i].id+"_fixed").remove()}}this._summariesRows.length=0},_removeUnusedFooterRows:function(oldRows){var i,j,sr=this._summariesRows,summariesRowsLength=this._summariesRows.length,hasFixedColumns=this.grid.hasFixedColumns(),oldRowsLength=oldRows.length;
if(summariesRowsLength===0){for(i=0;i<oldRowsLength;i++){this.grid._rootContainer().find("#"+oldRows.id).remove()}return}for(i=0;i<oldRowsLength;i++){for(j=0;j<summariesRowsLength;j++){if(sr[j].id===oldRows[i].id){continue}}if(j===summariesRowsLength){this.grid._rootContainer().find("#"+oldRows[i].id).remove();if(hasFixedColumns){this.grid._rootContainer().find("#"+oldRows[i].id+"_fixed").remove()}}}},_renderFooterIcons:function(startInd,endInd){var i,columnKey,sr=this._summariesRows,columnSetting,isToRemoveRow=true,gridColumns=this.grid.options.columns,gridColumnsLength=gridColumns.length,methodName;if(startInd===null||startInd===undefined){startInd=0}if(endInd===null||endInd===undefined){endInd=gridColumnsLength}if(sr.length===0){return}this._clearFooterIcons();methodName=sr[0].type;this._currentRowShownIcons=sr[0];for(i=startInd;i<endInd;i++){columnKey=gridColumns[i].key;if(this._disallowedSummaries[columnKey]===true){continue}columnSetting=this._getColumnSettingByKey(columnKey);if(columnSetting===null||columnSetting===undefined||columnSetting.length===0||columnSetting.allowSummaries===false){continue}isToRemoveRow=false;this._renderFooterIconMarkup(methodName,columnKey)}if(isToRemoveRow===true){this._removeRowsDataByType(methodName)}},_renderFooterIconMarkup:function(methodName,columnKey){var self=this,$td,$button;$button=$("<span></span>").appendTo(this.grid._rootContainer().find("#"+this._id("summaries","footer_row_icon_container",methodName,columnKey))).addClass(self.css.footerButtonIcon);$button.wrap("<a id='"+this._id("summaries","footer_row_button_dd",methodName,columnKey)+"' href='#' title='' tabindex='"+this.grid.options.tabIndex+"'></a>");$button.data("columnKey",columnKey);$td=$button.closest("td");$td.data("columnKey",columnKey);$td.unbind(".summaries");$td.bind({"mousedown.summaries":function(e){self.toggleDropDown(columnKey,e);e.stopPropagation()}});$button.parent().bind({mousedown:$.proxy(self._onMouseDownFooterIcon,self),click:$.proxy(self._onClickFooterIcon,self),mouseover:$.proxy(self._onMouseOverFooterIcon,self),mouseout:$.proxy(self._onMouseOutFooterIcon,self),focus:$.proxy(self._onMouseOverFooterIcon,self),blur:$.proxy(self._onMouseOutFooterIcon,self),keydown:function(event){if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){event.stopPropagation();event.preventDefault();self.toggleDropDown(null,event)}}})},_onMouseOverFooterIcon:function(e){var $button=$(e.target);if($button.closest("div").hasClass(this.css.footerButtonIconActive)===false){$button.closest("div").addClass(this.css.footerButtonIconHover)}},_onMouseOutFooterIcon:function(e){var $button=$(e.target);if($button.closest("div").hasClass(this.css.footerButtonIconActive)===false){$button.closest("div").removeClass(this.css.footerButtonIconHover)}},_onClickFooterIcon:function(e){e.preventDefault()},_onMouseDownFooterIcon:function(event){this.toggleDropDown(null,event)},_isFirstRowEmpty:function(){var i,res=true,columnKey,sr=this._summariesRows,data=null,row,gridColumns=this.grid.options.columns,gridColumnsLength=gridColumns.length;if(sr.length===0){return false}row=sr[0];for(i=0;i<gridColumnsLength;i++){columnKey=gridColumns[i].key;data=this._getDataByKeyMethodName(columnKey,row.type);if(data!==null){return false}}return res},toggleDropDown:function(columnKey,event){var $target,$dialog,top,left,self,isVisible,rOffset,$footersTable,$td;if(!event){if(this.grid.isFixedColumn(columnKey)){$footersTable=this.grid.fixedFootersTable()}else{$footersTable=this.grid.footersTable()}$target=$footersTable.find("tfoot tr:first-child td[ data-key="+columnKey+" ] a>span")}else{$td=$(event.target).closest("td");columnKey=$td.data("columnKey");$target=$td.find("a>span");if(!$target.length){return}}if(columnKey===null||columnKey===undefined){$target=$target.find("span");columnKey=$target.data("columnKey")}$dialog=this.grid._rootContainer().find("#"+this._id("summaries","methods_dialog",columnKey));top=$.ig.util.offset($target).top;left=$.ig.util.offset($target).left;self=this;isVisible=$dialog.is(":visible")===true;if($dialog.length===0||$dialog.data("isAnimating")===true){return}top-=$target.height()-2;if($target.is("span")===true){$dialog.data("buttonId",$target.parent().attr("id"))}if(!isVisible){rOffset=$.ig.util.getRelativeOffset($dialog);$dialog.css({top:top-$dialog.height()-rOffset.top,left:left-rOffset.left})}if(self._activeDialog!==null&&self._activeDialog!==undefined&&$dialog!==self._activeDialog&&columnKey!==self._activeDialog.data("columnKey")){self.showHideDialog(self._activeDialog)}if(isVisible===true){self._currentOpenedColumnKey=null}else{self._currentOpenedColumnKey=columnKey}self.showHideDialog($dialog)},showHideDialog:function($dialog){if($dialog===null||$dialog===undefined){return}var self=this,e=this.events,$button=this.grid._rootContainer().find("#"+$dialog.data("buttonId")),columnKey=$dialog.data("columnKey"),animationDuration=self.options.dropDownDialogAnimationDuration;if($dialog.data("isAnimating")===true&&self._activeDialog===$dialog){return}if($dialog.is(":visible")===true){if(this._trigger(e.dropDownClosing,null,{columnKey:columnKey,owner:this})===false){return}if($button!==null&&$button!==undefined){$button.closest("div").removeClass(self.css.footerButtonIconActive)}}else{if(this._trigger(e.dropDownOpening,null,{columnKey:columnKey,owner:this})===false){return}$dialog.css("min-width",self._getMinWidthOfDropDown($dialog));if($button!==null&&$button!==undefined){$button.closest("div").removeClass(self.css.footerButtonIconHover);$button.closest("div").addClass(self.css.footerButtonIconActive);this._rollbackCheckboxState(columnKey)}}if(animationDuration<=0){animationDuration=1}$dialog.data("isAnimating",true);$dialog.toggle("slide",{duration:animationDuration,direction:"down"},function(){$dialog.data("isAnimating",false);if($dialog.is(":visible")===true){$dialog.focus();self.grid._focusedElement=$dialog;self._activeDialog=$dialog;self._trigger(e.dropDownOpened,null,{columnKey:columnKey,owner:this})}else{self._trigger(e.dropDownClosed,null,{columnKey:columnKey,owner:this});self.grid._focusedElement=null;if(self.options.type==="remote"&&self.options.calculateRenderMode==="onselect"&&self.isToCalculateInRemoteMode===true){self.isToCalculateInRemoteMode=false;self._setDataSourceColumnSettingsOptions();self.grid.dataSource.dataBind()}if(self._activeDialog!==null&&self._activeDialog!==undefined&&self._activeDialog.data("columnKey")===columnKey){self._activeDialog=null}}})},_getMinWidthOfDropDown:function($dropDown){if(!$dropDown.length){return}var s=$dropDown.attr("style"),w;$dropDown.css({position:"absolute",display:"block",left:0,top:0,visibility:"hidden","min-width":""});w=$dropDown[0].getBoundingClientRect().width;$dropDown.attr("style",s);return Math.ceil(w)},_closeDropDown:function(){var $dialog=this._activeDialog;this.showHideDialog($dialog)},_setDataSourceColumnSettingsOptions:function(){var o=this.options;this.grid.dataSource.settings.summaries.columnSettings=this.newColumnSettings;this.grid.dataSource.settings.summaries.type=o.type;this.grid.dataSource.settings.summaries.summaryExecution=o.summaryExecution;this.grid.dataSource.settings.summaries.summaryExprUrlKey=o.summaryExprUrlKey;this.grid.dataSource.settings.summaries.summariesResponseKey=o.summariesResponseKey;if(this.grid.dataSource.type&&this.grid.dataSource.type()==="remoteUrl"&&this.grid._dataOptions&&$.type(this.grid._dataOptions.dataSource)==="string"){this.grid.dataSource.settings.dataSource=this.grid._dataOptions.dataSource}},_getColumnSettingByKey:function(columnKey){var i,len=this.columnSettings.length;if(columnKey===null||columnKey===undefined){return null}for(i=0;i<len;i++){if(this.columnSettings[i].columnKey===columnKey){return this.columnSettings[i]}}return null},_renderHeaderCellButton:function(columnCell,columnKey){var summaryHeaderIconContainer,self=this,css=self.css,buttonId=this._id("summaries","header_column_icon",columnKey),$button,$divHeaderButtonContainer;summaryHeaderIconContainer=columnCell.find(".ui-iggrid-indicatorcontainer");this.grid._enableHeaderCellFeature(columnCell);if(summaryHeaderIconContainer.length===0){summaryHeaderIconContainer=$("<div></div>").appendTo(columnCell);summaryHeaderIconContainer.addClass("ui-iggrid-indicatorcontainer")}this.grid._rootContainer().find("#"+buttonId).remove();$button=$("<a></a>").attr({href:"#",id:buttonId,tabindex:this.grid.options.tabIndex,title:this._getLocaleValue("summariesHeaderButtonTooltip"),"data-localeid":"summariesHeaderButtonTooltip","data-localeattr":"title"});$divHeaderButtonContainer=summaryHeaderIconContainer.find(".ui-iggrid-summaries-headerbuttoncontainer");if($divHeaderButtonContainer.length===0){$divHeaderButtonContainer=$("<div></div>").addClass(css.headerButtonContainer).appendTo(summaryHeaderIconContainer)}$button.appendTo($divHeaderButtonContainer);$("<span></span>").addClass(css.headerButtonIcon).appendTo($button);if($.ig.util.isIE7===true){$button.parent().addClass(this.css.baseClassIE7)}$button.hover(function(){$(this).parent().addClass(css.headerButtonIconHover)},function(){$(this).parent().removeClass(css.headerButtonIconHover)});$button.bind({click:function(event){event.preventDefault();event.stopPropagation();self._internalToggleSummariesRow(null,event)}})},_togglefromfc:function(event,columnKey,isSelected){this._internalToggleSummariesRow(isSelected,event)},_internalToggleSummariesRow:function(isToShow,event){if(isToShow===null||isToShow===undefined){isToShow=!this._isRenderedSummariesRows}if(this._trigger(this.events.summariesToggling,event,{isToShow:isToShow,owner:this})===false){return}this.toggleSummariesRows(isToShow,true);this._trigger(this.events.summariesToggled,event,{isShown:isToShow,owner:this})},toggleSummariesRows:function(isToShow,isInternalCall){var fc,cs,csLength,i,$hScroller,hScrollerLeft,grid=this.grid;if(isToShow===true){$hScroller=this.grid._rootContainer().find("#"+grid.id()+"_horizontalScrollContainer");if($hScroller.length>0&&(grid.options.columnVirtualization||grid._isColumnVirtualizationEnabled())){hScrollerLeft=$hScroller.scrollLeft();$hScroller.scrollLeft(0)}this.calculateSummaries();if(hScrollerLeft){setTimeout(function(){$hScroller.scrollLeft(hScrollerLeft)},0)}grid._synchronizeHScroll();this._isSummariesRowsHidden=false;if(this._summariesRows.length===0){cs=this.newColumnSettings;csLength=cs.length;this._insertSummariesRows(this.defaultSummaryMethods[0].type,this.defaultSummaryMethods[0].order);for(i=0;i<csLength;i++){if(!this._isVisibleColumn(cs[i].columnKey)){continue}this._renderFooterIconMarkup(this.defaultSummaryMethods[0].type,cs[i].columnKey)}}}else{this._removeFooterRows();this._isSummariesRowsHidden=true}if(this._isFixedFooters()){grid._fixedfooters().data("ignoreScroll",!isToShow)}this._adjustHeights();if(isInternalCall===undefined||isInternalCall===false){fc=grid.element.data("igGridFeatureChooser");if(fc!==null&&fc!==undefined){fc._toggleSelectedItems("Summaries",!isToShow)}}if(grid.hasFixedColumns()){if($.ig.util.isIE&&$.ig.util.browserVersion>=9){grid.element.data("igGridColumnFixing")._syncTableHeights()}this._syncFixedUnfixedRowHeights()}},_renderDropDown:function(columnKey){var $dialog,$ul,i,j,$buttonOK,$buttonCancel,$div,minInd,swap,$li,id=this._id("summaries","methods_dialog",columnKey),methodsLength,cs=this._getColumnSettingByKey(columnKey),css=this.css,checkboxId,allowedMethods,self=this,o=this.options,isChecked=false,cssClassCheckBox,onFocusLi,onMousedownLi,toggleState,onBlurLi,onKeydownLi,onMousedown,onMouseover,onMouseout,$checkbox,onClick;if(cs===null||cs===undefined){return}allowedMethods=cs.summaryOperands;if(allowedMethods===null||allowedMethods===undefined){return}this.grid._rootContainer().find("#"+id).remove();$dialog=$("<div></div>").appendTo(this.grid._rootContainer()).attr("id",id).css("position","absolute").css("width",this.options.dropDownWidth).css("height",this.options.dropDownHeight).addClass(this.css.columnSummariesDropdown).attr("tabindex",this.grid.options.tabIndex).hide();$dialog.data("methods",allowedMethods);$ul=$("<ul></ul>").addClass(css.dropDownListContainer);$ul.appendTo($dialog);methodsLength=allowedMethods.length;for(i=0;i<methodsLength;i++){minInd=i;for(j=i;j<methodsLength;j++){if(allowedMethods[j].order===null||allowedMethods[j].order===undefined){allowedMethods[j].order=0}if(allowedMethods[minInd].order>allowedMethods[j].order){minInd=j}}if(minInd!==i){swap=allowedMethods[minInd];allowedMethods[minInd]=allowedMethods[i];allowedMethods[i]=swap}}toggleState=function($checkbox,event){self.toggleCheckstate($checkbox);self._trigger(self.events.summariesMethodSelectionChanged,event,{columnKey:columnKey,isSelected:$checkbox.attr("data-chk").toLowerCase()==="on",methodName:$checkbox.data("methodName"),owner:this});if(o.calculateRenderMode==="onselect"){self._calculateSelectedSummaries(columnKey);if(self.grid.hasFixedColumns()){self._syncFixedUnfixedRowHeights()}}};onClick=function(event){toggleState($(event.currentTarget),event);if(self._activeDialog){self._activeDialog.data("focussed",true);self._activeDialog.focus()}event.preventDefault();event.stopPropagation()};onMousedown=function(event){if(self._activeDialog){self._activeDialog.data("focussed",true);self._activeDialog.focus()}event.preventDefault();event.stopPropagation()};onMouseover=function(event){$(event.currentTarget).addClass(css.checkboxHovered)};onMouseout=function(event){$(event.currentTarget).removeClass(css.checkboxHovered)};$dialog.bind({blur:function(){$dialog.data("focussed",false);setTimeout(function(){self._checkCloseDropDown($dialog)},10)},focus:function(){$dialog.data("focussed",true)},keydown:function(event){if(event.keyCode===$.ui.keyCode.ESCAPE||event.keyCode===$.ui.keyCode.SPACE||event.keyCode===$.ui.keyCode.ENTER){event.stopPropagation();event.preventDefault();self.toggleDropDown(null,event);if(self._summariesRows.length>0){self.grid.container().find("#"+self._id("summaries","footer_row_button_dd",self._summariesRows[0].type,columnKey)).focus()}}}});onFocusLi=function(){if(self._activeDialog){self._activeDialog.data("focussed",true)}};onBlurLi=function(){if(self._activeDialog){self._activeDialog.data("focussed",false)}setTimeout($.proxy(self._checkCloseDropDown,self),300)};onKeydownLi=function(event){var $liFocused=$(this),keyCode=event.keyCode;if(keyCode===$.ui.keyCode.ENTER||keyCode===$.ui.keyCode.SPACE){toggleState(self.grid.container().find("#"+$liFocused.data("checkboxId")),event);event.stopPropagation();event.preventDefault()}else if(keyCode===$.ui.keyCode.ESCAPE){$dialog.blur()}};onMousedownLi=function(event){toggleState(self.grid.container().find("#"+$(this).data("checkboxId")),event)};for(i=0;i<methodsLength;i++){checkboxId=this._id("summaries_footer_checkbox",allowedMethods[i].type.toLowerCase(),columnKey);if(allowedMethods[i].active===true||allowedMethods[i].active===1){isChecked="on";cssClassCheckBox=css.checkboxOn}else{isChecked="off";cssClassCheckBox=css.checkboxOff}$li=$("<li></li>").data("checkboxId",checkboxId).addClass(css.dropDownListItem).appendTo($ul).attr("tabindex",this.grid.options.tabIndex);$li.bind({focus:onFocusLi,blur:onBlurLi,keydown:onKeydownLi,mousedown:onMousedownLi});$("<span id='"+checkboxId+"' class='"+css.checkbox+"'></span>").appendTo($li);$("<label></label>").html(allowedMethods[i].rowDisplayLabel).appendTo($li);$checkbox=this.grid._rootContainer().find("#"+checkboxId);$("<span class='"+cssClassCheckBox+"'></span>").appendTo($checkbox);$checkbox.attr("data-chk",isChecked).attr("data-role","checkbox");$checkbox.data("methodName",allowedMethods[i].type);$checkbox.bind({click:onClick,mouseover:onMouseover,mouseout:onMouseout,mousedown:onMousedown})}$div=$("<div></div>").addClass(this.css.footerDropdownButtonsContainer).appendTo($dialog);if(o.calculateRenderMode==="okcancelbuttons"){$buttonOK=$("<a href='http://localhost/'></a>");$buttonOK.attr({id:this._id("summaries","dialog_button_ok",columnKey),tabindex:this.grid.options.tabIndex}).appendTo($div);$buttonOK.igButton({link:{href:"#",title:""},labelText:this._getLocaleValue("dialogButtonOKText"),keydown:function(event){if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){self._clickOKButton(columnKey)}if(event.keyCode!==$.ui.keyCode.TAB){event.stopPropagation();event.preventDefault()}},click:function(e){self._clickOKButton(columnKey);e.preventDefault();e.stopPropagation()},mousedown:function(event){event.preventDefault();event.stopPropagation()},focus:function(){if(self._activeDialog){self._activeDialog.data("focussed",true)}},blur:function(){if(self._activeDialog){self._activeDialog.data("focussed",false)}setTimeout($.proxy(self._checkCloseDropDown,self),300)}});$buttonCancel=$("<a></a>");$buttonCancel.attr({id:this._id("summaries","dialog_button_cancel",columnKey),tabindex:this.grid.options.tabIndex}).appendTo($div);$buttonCancel.igButton({link:{href:"#",title:""},labelText:this._getLocaleValue("dialogButtonCancelText"),click:function(e){self._clickCancelButton(columnKey);e.preventDefault();e.stopPropagation()},mousedown:function(event){event.preventDefault();event.stopPropagation()},focus:function(){if(self._activeDialog){self._activeDialog.data("focussed",true)}},blur:function(){if(self._activeDialog){self._activeDialog.data("focussed",false)}setTimeout($.proxy(self._checkCloseDropDown,self),300)}})}$dialog.data("columnKey",columnKey)},_checkCloseDropDown:function($dialog){if(this._activeDialog===null){return}if(this._activeDialog.data("focussed")===false){setTimeout($.proxy(this._closeDropDown,this),10);return}if($dialog&&$dialog.is(":visible")&&$dialog.attr("id")!==this._activeDialog.attr("id")){this.showHideDialog($dialog)}},toggleCheckstate:function($checkbox){var noCancel;noCancel=true;if(noCancel){if($checkbox.attr("data-chk")==="on"){this.selectCheckBox($checkbox,false)}else{this.selectCheckBox($checkbox,true)}}},selectCheckBox:function($checkbox,isToSelect){var css=this.css,$innerSpan=$checkbox.children("span");if(isToSelect===true){$innerSpan.removeClass(css.checkboxOff).addClass(css.checkboxOn);$checkbox.attr("data-chk","on")}else{$innerSpan.removeClass(css.checkboxOn).addClass(css.checkboxOff);$checkbox.attr("data-chk","off")}},_clickOKButton:function(columnKey){var i,j,cs,$checkbox,columnSettingsLength=this.columnSettings.length,methods,methodsLength,eventData=[],elem;if(columnKey===null||columnKey===undefined){return}for(j=0;j<columnSettingsLength;j++){if(this.columnSettings[j].columnKey===columnKey){cs=this.columnSettings[j];break}}if(cs===null||cs===undefined){return}methods=cs.summaryOperands;methodsLength=methods.length;for(i=0;i<methodsLength;i++){$checkbox=this.grid._rootContainer().find("#"+this._id("summaries_footer_checkbox",methods[i].type.toLowerCase(),columnKey));elem={type:methods[i].type.toLowerCase(),active:false};if($checkbox.attr("data-chk")!==undefined&&$checkbox.attr("data-chk").toLowerCase()==="on"){elem.active=true}eventData.push(elem)}this._trigger(this.events.dropDownOKClicked,null,{columnKey:columnKey,eventData:eventData,owner:this});this.showHideDialog(this.grid._rootContainer().find("#"+this._id("summaries","methods_dialog",columnKey)));this._calculateSelectedSummaries(columnKey);if(this.grid.hasFixedColumns()){this._syncFixedUnfixedRowHeights()}},_clickCancelButton:function(columnKey){this._trigger(this.events.dropDownCancelClicked,null,{columnKey:columnKey,owner:this});this.showHideDialog(this.grid._rootContainer().find("#"+this._id("summaries","methods_dialog",columnKey)))},_rollbackCheckboxState:function(columnKey){var cs,i,j,methods,isChecked,methodsLength,columnSettingsLength=this.columnSettings.length,$checkbox;if(columnKey===undefined||columnKey===null){return}for(j=0;j<columnSettingsLength;j++){if(this.columnSettings[j].columnKey===columnKey){cs=this.columnSettings[j];break}}if(cs===null||cs===undefined){return}methods=cs.summaryOperands;methodsLength=methods.length;for(i=0;i<methodsLength;i++){$checkbox=this.grid._rootContainer().find("#"+this._id("summaries_footer_checkbox",methods[i].type.toLowerCase(),columnKey));if($checkbox.attr("data-chk")!==undefined){isChecked=$checkbox.attr("data-chk").toLowerCase()==="on";if(methods[i].active!==isChecked){if(methods[i].active===true){this.selectCheckBox($checkbox,true)}else{this.selectCheckBox($checkbox,false)}}}}},_initCompactModeSummariesRows:function(){var i,j,k,cs=this.newColumnSettings,csLength=cs.length,columnMaxMethods=cs[0],cmm,cmmLength,countRowsToAdd,methodName,maxMethods=-1,summariesRowsLength,newMaxMethods;for(i=0;i<csLength;i++){if(!this._isVisibleColumn(cs[i].columnKey)){continue}newMaxMethods=0;if(cs[i].summaryOperands===null||cs[i].summaryOperands===undefined){continue}for(j=0;j<cs[i].summaryOperands.length;j++){if(cs[i].summaryOperands[j].active===true){newMaxMethods++}}newMaxMethods=Math.max(newMaxMethods,1);if(newMaxMethods>maxMethods){maxMethods=newMaxMethods;columnMaxMethods=cs[i]}}if(columnMaxMethods===undefined||columnMaxMethods===null){return}cmm=columnMaxMethods.summaryOperands;cmmLength=cmm.length;summariesRowsLength=this._summariesRows.length;if(summariesRowsLength>maxMethods){return}countRowsToAdd=maxMethods-summariesRowsLength;if(countRowsToAdd===0){return}k=0;for(i=0;i<cmmLength;i++){methodName=cmm[i].type.toLowerCase();if(this.grid._rootContainer().find("#"+this._id("summaries","footer_row",methodName)).length===0){this._insertSummariesRows(methodName,null);if(++k===countRowsToAdd){break}}}},_calculateInternalSummaries:function(){var cs=this.newColumnSettings,csLength=cs.length,i,o=this.options,data,res,e=this.events;if(this._trigger(e.summariesCalculating,null,{owner:this})===false){return}data=this._dataSummaries();if(o.callee!==null&&o.callee!==undefined&&$.type(o.callee)==="function"){data=o.callee(data)}if(data===null||data===undefined){data=[]}if(o.compactRenderingMode===true||o.compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===true){this._initCompactModeSummariesRows()}for(i=0;i<csLength;i++){if(!this._isVisibleColumn(cs[i].columnKey)){continue}res=this.calculateSummaryColumn(cs[i].columnKey,cs[i].summaryOperands,data,cs[i].dataType);this._renderFooterColumnInfo(cs[i].columnKey,res)}this._isRenderedSummariesRows=true;this._trigger(e.summariesCalculated,null,{data:data,owner:this})},_isVisibleColumn:function(columnKey){var cols=this.grid._visibleColumns(),ret=false;$.each(cols,function(index,value){if(value.key===columnKey){ret=true;return false}});return ret},calculateSummaryColumn:function(ck,columnMethods,data,dataType){var i,j,val,o=this.options,columnMethodsLength,tmpArr=[],rowsCount=0,res=[],order,resultCalculated,resElement,methodName,gridDataSource,isDate,isTime,cellValue;if(ck===null||ck===undefined){throw new Error(this._getLocaleValue("calculateSummaryColumnKeyNotSpecified"))}if(columnMethods===undefined||columnMethods===null){return}columnMethodsLength=columnMethods.length;if(o.type==="local"){rowsCount=data.length;isDate=dataType==="date";isTime=dataType==="time";if(isDate===true||isTime===true){for(i=0;i<rowsCount;i++){if(data[i][ck]!==null&&data[i][ck]!==undefined){if(data[i][ck].getTime){cellValue=this.grid.dataSource.getCellValue(ck,data[i]);tmpArr.push(isDate?cellValue.getTime():$.ig.Date.prototype.resetDateToCurrentDate(cellValue).getTime())}else{tmpArr.push(this.grid.dataSource.getCellValue(ck,data[i]))}}}}else{for(i=0;i<rowsCount;i++){if(data[i][ck]===undefined){data[i][ck]=null}tmpArr.push(this.grid.dataSource.getCellValue(ck,data[i]))}}for(i=0;i<columnMethodsLength;i++){methodName=columnMethods[i].type.toLowerCase();if(methodName.startsWith("custom")){methodName="custom"}if(columnMethods[i].active===true||columnMethods[i].active===1){order=columnMethods[i].order;if(order===undefined){order=null}if(methodName==="count"){resultCalculated=rowsCount}else{resultCalculated=$.ig.calcSummaries(methodName,tmpArr,columnMethods[i].summaryCalculator,dataType)}resElement={type:columnMethods[i].type,result:resultCalculated,rowDisplayLabel:columnMethods[i].rowDisplayLabel,order:order,format:columnMethods[i].format,dataType:dataType};res.push(resElement);this._addDataResult(ck,resElement)}}}else if(o.type==="remote"){if(data[ck]!==undefined&&data[ck]!==null){for(i=0;i<columnMethodsLength;i++){val=data[ck][columnMethods[i].type];if(columnMethods[i].active===true||columnMethods[i].active===1){order=columnMethods[i].order;if(order===undefined){order=null}if(val===null||val===undefined){if(columnMethods[i].summaryCalculator!==undefined){gridDataSource=this.grid.dataSource._data;rowsCount=gridDataSource.length;isDate=dataType==="date";isTime=dataType==="time";if(isDate===true||isTime===true){for(j=0;j<rowsCount;j++){if(gridDataSource[j][ck]!==null&&gridDataSource[j][ck]!==undefined){cellValue=this.grid.dataSource.getCellValue(ck,gridDataSource[j]);tmpArr.push(isDate?cellValue.getTime():$.ig.Date.prototype.resetDateToCurrentDate(cellValue).getTime())}}}else{for(j=0;j<rowsCount;j++){tmpArr.push(this.grid.dataSource.getCellValue(ck,gridDataSource[j]))}}val=$.ig.calcSummaries(columnMethods[i].type.toLowerCase(),tmpArr,columnMethods[i].summaryCalculator,dataType)}else{val=""}}res.push({type:columnMethods[i].type,result:val,rowDisplayLabel:columnMethods[i].rowDisplayLabel,order:order,format:columnMethods[i].format,dataType:dataType})}}}this._data[ck]=res}return res},summaryCollection:function(){return this._data},summariesFor:function(columnKey){return this._data[columnKey]},_addDataResult:function(columnKey,resElement){var d=this._data[columnKey],i,dLen;if(d===null||d===undefined){this._data[columnKey]=[];this._data[columnKey].push(resElement);return}dLen=d.length;for(i=0;i<dLen;i++){if(d[i].type.toLowerCase()===resElement.type.toLowerCase()){d[i]=resElement;break}}if(i===dLen){this._data[columnKey].push(resElement)}},_removeDataResult:function(columnKey,methodName){var d=this._data[columnKey];if(d===undefined||d===null){return}d=$.grep(d,function(n){return n.type.toLowerCase()!==methodName.toLowerCase()});this._data[columnKey]=d},_getDataByKeyMethodName:function(columnKey,methodName){var i,d=this._data[columnKey],dLength,res=null;methodName=methodName.toLowerCase();if(d===undefined||d===null){return null}dLength=d.length;for(i=0;i<dLength;i++){if(d[i].type.toLowerCase()===methodName){return d[i]}}return res},_updateDataLabels:function(columnKey){var d=this._data[columnKey],dLength=d.length,dsm=this.defaultSummaryMethods,dsmLength=dsm.length,i,j;for(i=0;i<dLength;i++){for(j=0;j<dsmLength;j++){if(dsm[j].type===d[i].type){d[i].rowDisplayLabel=dsm[j].rowDisplayLabel}}}},_updateColumnSettings:function(columnKey){var columnSetting=this._getColumnSettingByKey(columnKey),dsm=this.defaultSummaryMethods,dsmLength=dsm.length,i,j;for(i=0;i<columnSetting.summaryOperands.length;i++){for(j=0;j<dsmLength;j++){if(dsm[j].type===columnSetting.summaryOperands[i].type){columnSetting.summaryOperands[i].rowDisplayLabel=dsm[j].rowDisplayLabel}}}},_renderFooterColumnInfo:function(columnKey,data){if(data===null||data===undefined){return}var i,j,methodName,footerRowId,$footerRow,order,compactRenderingMode=this.options.compactRenderingMode,dataLength=data.length,min,swapElement;if(compactRenderingMode===true||this.options.compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===true){if(dataLength>1){for(i=0;i<dataLength;i++){min=i;for(j=i+1;j<dataLength;j++){if(data[j].order<data[min].order){swapElement=data[j];data[j]=data[min];data[min]=swapElement;min=j}}}}for(i=0;i<dataLength;i++){if(this._summariesRows[i]===undefined||this._summariesRows[i]===null||data[i]===undefined||data[i]===null){continue}this._renderCellHandler(this._summariesRows[i].type,columnKey,data[i])}}else if(compactRenderingMode===false||this.options.compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===false){for(i=0;i<dataLength;i++){methodName=data[i].type.toLowerCase();footerRowId=this._id("summaries","footer_row",methodName);$footerRow=this.grid._rootContainer().find("#"+footerRowId);if($footerRow.length===0){order=data[i].order;if(order===undefined){order=null}this._addDataResult(columnKey,data[0]);this._insertSummariesRows(methodName,order)}this._renderCellHandler(methodName,columnKey,data[i])}}},_renderCell:function(methodName,columnKey,data){var resultTemplate=this.options.resultTemplate,column,value=data.result,res,oColumnType,oColumnFormat,oFormatted,summaryOperand=data.type,rowDisplayLabel=data.rowDisplayLabel,format=data.format,dataType=data.dataType,isNumber=this._isNumber(value),applyFormat=true;if(isNumber&&dataType==="bool"){applyFormat=false}if((dataType==="date"||dataType==="time")&&isNumber&&(summaryOperand==="min"||summaryOperand==="max")){value=new Date(parseInt(value,10))}if(format===undefined&&applyFormat){column=this._getGridColumnFor(columnKey);if(column!==null){oColumnFormat=column.format;oColumnType=column.dataType;oFormatted=column.formatted;if(summaryOperand==="count"){column.format="0";column.dataType="number"}value=this.grid._renderCell(value,column);column.format=oColumnFormat;column.dataType=oColumnType;column.formatted=oFormatted}}else if(applyFormat){value=$.ig.formatter(value,dataType,format)}if(value===null||value===undefined){value=""}if(resultTemplate){res=resultTemplate.replace("{0}",rowDisplayLabel).replace("{1}",value)}else{res=value}this.grid._rootContainer().find("#"+this._id("summaries","footer_row_text_container",methodName,columnKey)).html(res)},_getGridColumnFor:function(columnKey){var i,gridColumnsLength=this.grid.options.columns?this.grid.options.columns.length:0;for(i=0;i<gridColumnsLength;i++){if(this.grid.options.columns[i].key===columnKey){return this.grid.options.columns[i]}}return null},_isNumber:function(n){return!isNaN(parseFloat(n))&&isFinite(n)},_columnsCollectionModified:function(event,ui){if(ui.owner.element.attr("id")!==this.grid.element.attr("id")){return}if(this._isSummariesRowsHidden===true){return}this._clearAllRows();this.calculateSummaries()},_insertSummariesRows:function(methodName,order){methodName=methodName.toLowerCase();var srLength,i,j,srOrder,hasFixed=this.grid.hasFixedColumns(),css=this.css,$grid=this.grid,gridColumns=$grid._visibleColumns(),gridColumnsLength=gridColumns.length,$tfoot=this._tfoot,$td,$tfootFixed,$footer=$grid._footer,footerRowIdFixed,$footerRowFixed,footerRowId=this._id("summaries","footer_row",methodName),$footerRow=$("<tr></tr>").attr("id",footerRowId).attr("data-role","summaryrow"),elem={id:footerRowId,type:methodName,order:order},footerRowCellMousein=function(){$(this).addClass(css.footerRowCellHover)},footerRowCellMouseout=function(){$(this).removeClass(css.footerRowCellHover)};if(hasFixed===true){footerRowIdFixed=this._id("summaries","footer_row",methodName,"fixed");$footerRowFixed=$("<tr></tr>").attr("id",footerRowIdFixed).attr("data-role","summaryrow");$tfootFixed=this.grid.fixedFootersTable().find("tfoot")}if($tfoot===null||$tfoot===undefined){if($footer===undefined||$footer===null||$footer.length===0){$grid._renderFooter();$footer=$grid._footer}if($footer===undefined||$footer===null||$footer.length===0){return}$footer.css("display","");if(this._isVirtualization()===true){$tfoot=this.grid.footersTable().find("tfoot")}else if(this._isFixedFooters()===true){$tfoot=$footer.find("tfoot")}else{$tfoot=$footer}this._tfoot=$tfoot}if($tfoot.attr("id")!==""&&$tfoot.attr("id")!==null&&$tfoot.attr("id")!==undefined){$tfoot=this.grid._rootContainer().find("#"+$tfoot.attr("id"))}if(order===null){elem.order=this._summariesRows.length;this._summariesRows.push(elem);$footerRow.appendTo($tfoot);if(hasFixed){$footerRowFixed.appendTo($tfootFixed)}}else{srLength=this._summariesRows.length;if(srLength===0){this._summariesRows.push(elem);$footerRow.appendTo($tfoot);if(hasFixed){$footerRowFixed.appendTo($tfootFixed)}}else{if(this.options.compactRenderingMode===true||this.options.compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===true){$footerRow.appendTo($tfoot);if(hasFixed){$footerRowFixed.appendTo($tfootFixed)}this._summariesRows.push(elem);
}else if(this.options.compactRenderingMode===false||this.options.compactRenderingMode==="auto"&&this._analyzeAutoCompactRenderingMode()===false){for(i=0;i<srLength;i++){srOrder=this._summariesRows[i].order;if(srOrder===undefined||srOrder===null){continue}if(order<=srOrder){$footerRow.insertBefore(this.grid._rootContainer().find("#"+this._id("summaries","footer_row",this._summariesRows[i].type)));if(hasFixed){$footerRowFixed.insertBefore(this.grid._rootContainer().find("#"+this._id("summaries","footer_row",this._summariesRows[i].type,"fixed")))}this._summariesRows.splice(i,0,elem);break}}if(i===srLength){this._summariesRows.push(elem);$footerRow.appendTo($tfoot);if(hasFixed){$footerRowFixed.appendTo($tfootFixed)}}}}}if(this._isVirtualization()&&this.grid.options.virtualizationMode==="fixed"&&!hasFixed){gridColumnsLength=this.grid._virtualColumnCount}for(j=0;j<gridColumnsLength;j++){$td=$("<td></td>").attr("tabIndex",this.grid.options.tabIndex).attr("aria-describedby",this.grid.id()+"_"+gridColumns[j].key).addClass(css.footerRowCell).attr("data-key",gridColumns[j].key);if(gridColumns[j].fixed===true){$td.appendTo($footerRowFixed);this.grid._rootContainer().find("#"+footerRowIdFixed+" td.ui-state-default").hover(footerRowCellMousein,footerRowCellMouseout)}else{$td.appendTo($footerRow);this.grid._rootContainer().find("#"+footerRowId+" td.ui-state-default").hover(footerRowCellMousein,footerRowCellMouseout)}if(j===gridColumnsLength-1&&$grid.options.height&&parseInt($grid.options.height,10)>0){$td.css("width",parseInt(gridColumns[j].width,10)+$grid._scrollbarWidth())}else{$td.css("width",gridColumns[j].width)}this._renderInnerCellMarkup($td,methodName,gridColumns[j].key)}if(hasFixed&&this.grid.hasFixedDataSkippedColumns()&&this.grid.fixingDirection()==="left"){this.grid._footerInit($footerRowFixed,null,true,css.footerRowCell)}else{this.grid._footerInit($footerRow,null,true,css.footerRowCell)}},_renderInnerCellMarkup:function($td,methodName,columnKey){var $textContainer,$iconContainer;$textContainer=$("<div></div>").attr("id",this._id("summaries","footer_row_text_container",methodName,columnKey)).addClass(this.css.footerRowTextContainer).appendTo($td).attr("data-localeid","emptyCellText").html(this._getLocaleValue("emptyCellText"));$iconContainer=$("<div></div>").attr("id",this._id("summaries","footer_row_icon_container",methodName,columnKey)).addClass(this.css.footerRowIconContainer).insertBefore($textContainer);if($.ig.util.isIE7===true){$iconContainer.addClass(this.css.baseClassIE7)}if(this.options.showDropDownButton===false){$iconContainer.addClass(this.css.footerRowIconContainerEmpty);$textContainer.addClass(this.css.footerRowTextContainerEmpty)}},_virtualHorizontalScroll:function(event,args){if(this._isRenderedSummariesRows===false){return}var start=args.startColIndex,end=args.endColIndex,i,j,$row,$children,$td,sr=this._summariesRows,srLength=sr.length,columnSetting,columnKey,cols=this.grid._visibleColumns(),self=this;end=start+this.grid._virtualColumnCount;if(srLength>0){$children=sr[0];$.each($children,function(index,element){self.grid._rootContainer().find("#"+self._id("summaries","methods_dialog",$(element).attr("data-key"))).remove()})}for(i=0;i<srLength;i++){$row=this.grid._rootContainer().find("#"+sr[i].id);$children=$row.children();$children.html("");for(j=start;j<=end;j++){$td=$row.find("td:nth-child("+(j-start+1)+")");$td.html("");if(cols[j]===null||cols[j]===undefined){continue}this._renderInnerCellMarkup($td,sr[i].type,cols[j].key)}}for(i=start;i<end;i++){if(cols[i]!==null&&cols[i]!==undefined){columnKey=cols[i].key;columnSetting=this._getColumnSettingByKey(columnKey);if(columnKey===undefined||columnKey===null){continue}this._renderFooterIconMarkup(sr[0].type,columnKey);this._renderDropDown(columnKey);if(columnSetting===null||columnSetting===undefined){continue}this._renderFooterColumnInfo(columnKey,this._data[columnKey])}}if(this.grid.hasFixedColumns()){this._syncFixedUnfixedRowHeights()}},_isFixedFooters:function(){return this.grid.options.fixedFooters===true&&this.grid.options.height!==null},_isVirtualization:function(){var gridOptions=this.grid.options;return gridOptions.virtualization===true||gridOptions.rowVirtualization===true&&gridOptions.height!==null||gridOptions.columnVirtualization===true&&gridOptions.width!==null},_id:function(){var i,res=this.grid.element[0].id,argumentsLength=arguments.length;if(argumentsLength===0){return null}for(i=0;i<argumentsLength;i++){res+="_"+arguments[i]}return res},_getColumnFixingInstance:function(){return this.grid.element.data("igGridColumnFixing")},_isAllowedMethodName:function(methodName){var defaultMethodName,isAllowed=false,len=this.defaultSummaryMethods.length,i;for(i=0;i<len;i++){defaultMethodName=this.defaultSummaryMethods[i].type;if(defaultMethodName===methodName||defaultMethodName===methodName.substr(0,defaultMethodName.length)){isAllowed=true;break}}return isAllowed},_footerInit:function(owner,args){if(args.owner.element.attr("id")!==this.grid.element.attr("id")){return}var rows,i;rows=this.grid.footersTable().find("[ data-role=summaryrow ]");rows.find("[ data-skip=true ]").remove();for(i=0;i<rows.length;i++){this.grid._footerInit($(rows[i]),null,true,this.css.footerRowCell)}},_dataSummaries:function(){var ds=this.grid.dataSource;return ds.dataSummaries()},_injectGrid:function(gridInstance){this.grid=gridInstance;if(this.options.type===null){this.options.type=this.grid._inferOpType()}this._detachEvents();this._headerRenderedHandler=$.proxy(this._headerRendered,this);this._footerRenderedHandler=$.proxy(this._footerRendered,this);this._headerCellRenderedHandler=$.proxy(this._headerCellRendered,this);this._headerFooterInitHandler=$.proxy(this._footerInit,this);this._columnsCollectionModifiedHandler=$.proxy(this._columnsCollectionModified,this);this.grid.element.bind("iggridheaderrendered",this._headerRenderedHandler);this.grid.element.bind("iggridfooterrendered",this._footerRenderedHandler);this.grid.element.bind("iggridheadercellrendered",this._headerCellRenderedHandler);this.grid.element.bind("iggridheaderextracellsmodified",this._headerFooterInitHandler);this.grid.element.bind("iggridcolumnscollectionmodified",this._columnsCollectionModifiedHandler);this._virtualHorizontalScrollHandler=$.proxy(this._virtualHorizontalScroll,this);this.grid.element.bind("iggridvirtualhorizontalscroll",this._virtualHorizontalScrollHandler);this._initColumnSettings();this._setDataSourceColumnSettingsOptions();if(this.grid.element.igGridFeatureChooser!==undefined){this.grid.element.igGridFeatureChooser()}else{throw new Error(this._getLocaleValue("featureChooserNotReferenced"))}}});$.extend($.ui.igGridSummaries,{version:"21.2.12"});return $});