/*!@license
* Infragistics.Web.ClientUI Pivot Grid localization resources 15.2.20152.1027
*
* Copyright (c) 2011-2015 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
(function($){$.ig=$.ig||{};if(!$.ig.PivotGrid){$.ig.PivotGrid={};$.extend($.ig.PivotGrid,{locale:{filtersHeader:"Drop Filter Fields Here",measuresHeader:"Drop Data Items Here",rowsHeader:"Drop Row Fields Here",columnsHeader:"Drop Column Fields Here",disabledFiltersHeader:"Filter Fields",disabledMeasuresHeader:"Data Items",disabledRowsHeader:"Row Fields",disabledColumnsHeader:"Column Fields",noSuchAxis:"No such axis"}})}})(jQuery);/*!@license
* Infragistics.Web.ClientUI Pivot Grid 15.2.20152.1027
*
* Copyright (c) 2011-2012 Infragistics Inc.
*
* http://www.infragistics.com/
*
* Depends on: 
*	jquery-1.4.4.js
*	jquery.ui.core.js
*	jquery.ui.widget.js
*	jquery.ui.mouse.js
*	jquery.ui.draggable.js
*	jquery.ui.droppable.js
*	modernizr.js (Optional)
*	infragistics.util.js
*	infragistics.datasource.js
*	infragistics.olapxmladatasource.js
*	infragistics.olapflatdatasource.js
*	infragistics.ui.shared.js
*   infragistics.ui.scroll.js
*	infragistics.ui.tree.js
*	infragistics.ui.grid.framework.js
*	infragistics.ui.grid.multicolumnheaders.js
*	infragistics.ui.pivot.shared.js
*/
(function($){function Matrix(){this[0]=[]}Matrix.prototype=[];Matrix.prototype.set=function(row,column,value){if(this.length<row+1){this.setRowCount(row+1)}if(this[0].length<column+1){this.setColumnCount(column+1)}this[row][column]=value};Matrix.prototype.setRowCount=function(rowCount){var i,oldRowCount=this.length;this.length=rowCount;for(i=oldRowCount;i<rowCount;i++){this[i]=[];this[i].length=this[0].length}};Matrix.prototype.setColumnCount=function(columnCount){var i;for(i=0;i<this.length;i++){this[i].length=columnCount}};var _aNull=function(val){return val===null||val===undefined},_igGrid=$.ui.igGrid.prototype.widgetFullName||$.ui.igGrid.prototype.widgetName;$.widget("ui.igPivotGrid",{css:{pivotGrid:"ui-igpivotgrid",pivotGridHeader:"ui-igpivotgrid-header",expandButton:"ui-iggrid-headerbutton ui-icon ui-icon-plus",collapseButton:"ui-iggrid-headerbutton ui-iggrid-headerbuttonexpanded ui-icon ui-icon-minus",rowsAscending:"ui-iggrid-sortindicator ui-icon ui-icon-triangle-1-n",rowsDescending:"ui-iggrid-sortindicator ui-icon ui-icon-triangle-1-s",headerRowsAscending:"ui-iggrid-sortindicator ui-icon ui-icon-triangle-1-n",headerRowsDescending:"ui-iggrid-sortindicator ui-icon ui-icon-triangle-1-s",headerColumnsAscending:"ui-iggrid-sortindicator ui-icon ui-icon-triangle-1-n",headerColumnsDescending:"ui-iggrid-sortindicator ui-icon ui-icon-triangle-1-s",blockArea:"ui-igpivotgrid-blockarea",metadataItem:"ui-igpivot-metadataitem ui-widget ui-corner-all ui-state-default",dropAreaHeader:"ui-igpivot-dropareaheader ui-iggrid-header ui-widget-header",scrollButton:"ui-iggrid-headerbutton",scrollLeft:"ui-icon ui-icon-triangle-1-w",scrollRight:"ui-icon ui-icon-triangle-1-e",dropArea:"ui-igpivot-droparea",overlayDropArea:"ui-igpivot-overlaydroparea",activeDropArea:"active",dropIndicator:"ui-state-highlight",invalidDropIndicator:"ui-state-error",insertItem:"ui-igpivot-insertitem ui-state-highlight ui-corner-all",metadataItemDropDown:"ui-igpivot-metadatadropdown ui-widget ui-widget-content",filterIcon:"ui-icon ui-icon-pivot-smallfilter",filterDropDown:"ui-igpivot-filterdropdown ui-widget ui-widget-content",filterMembers:"ui-igpivot-filtermembers"},options:{width:null,height:null,dataSource:null,dataSourceOptions:{xmlaOptions:{serverUrl:null,catalog:null,cube:null,measureGroup:null,requestOptions:{withCredentials:false,beforeSend:null},enableResultCache:true,discoverProperties:null,executeProperties:null,mdxSettings:{nonEmptyOnRows:true,nonEmptyOnColumns:true,addCalculatedMembersOnRows:true,addCalculatedMembersOnColumns:true,dimensionPropertiesOnRows:[],dimensionPropertiesOnColumns:[]}},flatDataOptions:{dataSource:null,dataSourceUrl:null,dataSourceType:null,responseDataKey:null,responseDataType:null,metadata:{cube:{name:null,caption:null,measuresDimension:{name:null,caption:null,measures:[{name:null,caption:null,aggregator:null,displayFolder:null}]},dimensions:[{name:null,caption:null,hierarchies:[{name:null,caption:null,displayFolder:null,levels:[{name:null,caption:null,memberProvider:null}]}]}]}}},measures:null,filters:null,rows:null,columns:null},deferUpdate:false,isParentInFrontForColumns:false,isParentInFrontForRows:true,compactColumnHeaders:false,compactRowHeaders:true,rowHeadersLayout:null,compactColumnHeaderIndentation:30,compactRowHeaderIndentation:20,rowHeaderLinkGroupIndentation:5,treeRowHeaderIndentation:10,defaultRowHeaderWidth:200,allowSorting:false,firstSortDirection:"ascending",allowHeaderRowsSorting:false,allowHeaderColumnsSorting:false,levelSortDirections:[{levelUniqueName:null,sortDirection:null,sortBehavior:null}],defaultLevelSortBehavior:"alphabetical",firstLevelSortDirection:"ascending",gridOptions:{defaultColumnWidth:null,fixedHeaders:true,caption:null,features:[],tabIndex:0,alternateRowStyles:true,enableHoverStyles:false},dragAndDropSettings:{appendTo:"body",containment:false,zIndex:10},dropDownParent:"body",disableRowsDropArea:false,disableColumnsDropArea:false,disableMeasuresDropArea:false,disableFiltersDropArea:false,hideRowsDropArea:false,hideColumnsDropArea:false,hideMeasuresDropArea:false,hideFiltersDropArea:false,customMoveValidation:null},events:{dataSourceInitialized:null,dataSourceUpdated:null,pivotGridHeadersRendered:null,pivotGridRendered:null,tupleMemberExpanding:null,tupleMemberExpanded:null,tupleMemberCollapsing:null,tupleMemberCollapsed:null,sorting:null,sorted:null,headersSorting:null,headersSorted:null,dragStart:null,drag:null,dragStop:null,metadataDropping:null,metadataDropped:null,metadataRemoving:null,metadataRemoved:null,filterDropDownOpening:null,filterDropDownOpened:null,filterMembersLoaded:null,filterDropDownOk:null,filterDropDownClosing:null,filterDropDownClosed:null},_const:{emptyCell:{headerText:"&nbsp;",key:"empty_cell",axisName:"empty_axis",memberIndex:0,tupleIndex:0},hoverScrollOffset:5,hoverScrollInterval:50},_headerScrollOffsets:{},_gridScrollOffsets:{top:0,left:0},_create:function(){var $this=this;this._onFiltersChanged=function(collection,collectionChangedArgs){var dropArea=$("#"+$this.element.attr("id")+"_filters .ui-igpivot-droparea");$this._onDataSourceCollectionChanged(collection,collectionChangedArgs,dropArea,$this.options.disableFiltersDropArea);$this._updateDropArea(dropArea,$this._ds.filters(),$this.options.disableFiltersDropArea,$this.options.disableFiltersDropArea?$.ig.PivotGrid.locale.disabledFiltersHeader:$.ig.PivotGrid.locale.filtersHeader)};this._onRowAxisChanged=function(collection,collectionChangedArgs){var dropArea=$("#"+$this.element.attr("id")+"_rows .ui-igpivot-droparea");$this._onDataSourceCollectionChanged(collection,collectionChangedArgs,dropArea,$this.options.disableRowsDropArea);$this._updateDropArea(dropArea,$this._ds.rowAxis(),$this.options.disableRowsDropArea,$this.options.disableRowsDropArea?$.ig.PivotGrid.locale.disabledRowsHeader:$.ig.PivotGrid.locale.rowsHeader)};this._onColumnAxisChanged=function(collection,collectionChangedArgs){var dropArea=$("#"+$this.element.attr("id")+"_columns .ui-igpivot-droparea");$this._onDataSourceCollectionChanged(collection,collectionChangedArgs,dropArea,$this.options.disableColumnsDropArea);$this._updateDropArea(dropArea,$this._ds.columnAxis(),$this.options.disableColumnsDropArea,$this.options.disableColumnsDropArea?$.ig.PivotGrid.locale.disabledColumnsHeader:$.ig.PivotGrid.locale.columnsHeader);$this._columnsChanged=true};this._onMeasuresChanged=function(collection,collectionChangedArgs){var dropArea=$("#"+$this.element.attr("id")+"_measures .ui-igpivot-droparea");$this._onDataSourceCollectionChanged(collection,collectionChangedArgs,dropArea,$this.options.disableMeasuresDropArea);$this._updateDropArea(dropArea,$this._ds.measures(),$this.options.disableMeasuresDropArea,$this.options.disableMeasuresDropArea?$.ig.PivotGrid.locale.disabledMeasuresHeader:$.ig.PivotGrid.locale.measuresHeader)};this.element.addClass(this.css.pivotGrid);this._setDataSource()},_setOption:function(key,value){var grid;switch(key){case"dataSource":this._clearDataSource();this.options.dataSourceOptions=null;this.options.dataSource=this._createDataSource(value,null);this._setDataSource();break;case"dataSourceOptions":this._clearDataSource();this.options.dataSourceOptions=value;this.options.dataSource=this._createDataSource(null,value);this._setDataSource();break;case"deferUpdate":$.Widget.prototype._setOption.apply(this,arguments);if(value===false){this.updateGrid()}break;case"width":case"height":$.Widget.prototype._setOption.apply(this,arguments);grid=this.grid();if(grid){grid.option(key,value)}break;case"levelSortDirections":case"isParentInFrontForColumns":case"isParentInFrontForRows":case"compactColumnHeaders":case"compactRowHeaders":case"rowHeadersLayout":$.Widget.prototype._setOption.apply(this,arguments);this._createTableView(this._ds);this._onGridUpdated();break;case"dragAndDropSettings":$.Widget.prototype._setOption.apply(this,arguments);this.element.find(":ui-draggable").each(function(ind,el){var draggable=$(el);draggable.draggable("option","appendTo",value.appendTo);draggable.draggable("option","containment",value.containment);draggable.draggable("option","zIndex",value.zIndex)});break;default:$.Widget.prototype._setOption.apply(this,arguments);this._onGridUpdated();break}},_setDataSource:function(){var $this=this,dataSource;this._renderEmptyGrid();this._ds=dataSource=this._createDataSource(this.options.dataSource,this.options.dataSourceOptions);if(!dataSource){return}if(this.options.rowHeadersLayout==="tree"&&dataSource.dataSource().measureListLocation()===0&&dataSource.dataSource().sourceOptions().measures()&&dataSource.dataSource().sourceOptions().measures().contains(",")){this._ds.setMeasureListIndex(0)}this.timestamp=(new Date).getTime();$(dataSource).bind("initialized.pivotgrid"+this.timestamp,function(evt,evtArgs){var args=$.extend({owner:$this,dataSource:$this._ds},evtArgs);$this._triggerDataSourceInitialized(evt,args);$this._onGridUpdated()});$(dataSource).bind("updated.pivotgrid"+this.timestamp,function(evt,evtArgs){var args=$.extend({owner:$this,dataSource:$this._ds},evtArgs);$this._triggerDataSourceUpdated(evt,args);$this._onGridUpdated()});if(dataSource.isInitialized()){dataSource.bindCollectionChanged({filters:this._onFiltersChanged,rowAxis:this._onRowAxisChanged,columnAxis:this._onColumnAxisChanged,measures:this._onMeasuresChanged});this._onGridUpdated()}else{this._updateGrid(true).always(function(){dataSource.bindCollectionChanged({filters:$this._onFiltersChanged,rowAxis:$this._onRowAxisChanged,columnAxis:$this._onColumnAxisChanged,measures:$this._onMeasuresChanged})})}},_updateDropArea:function(dropArea,items,isDisabled,emptyMessage){if(!this._ds.isUpdating()&&!$.ig.util.isTouchDevice()){dropArea.empty().css({display:"",overflow:"",margin:"",padding:""}).siblings().remove();this._fillDropArea(dropArea,items,isDisabled,emptyMessage);this._measureDropArea(dropArea)}},_clearDataSource:function(){var grid=this.grid();if(this._ds){$(this._ds).unbind("updated.pivotgrid");this._ds.unbindCollectionChanged({filters:this._onFiltersChanged,rowAxis:this._onRowAxisChanged,columnAxis:this._onColumnAxisChanged,measures:this._onMeasuresChanged})}if(grid){grid.destroy();this.element.empty()}},_createTableView:function(dataSource){var viewSettings,hasColumns,hasRows,rowHeadersLayout,map,appliedColumnSortDirections,appliedLevelSortDirections,userLevelSortDirections,mergedLevelSortDirections;appliedColumnSortDirections=this._columnsChanged?[]:this.appliedColumnSortDirections();map=function(array){var i,m={};if($.isArray(array)){for(i=0;i<array.length;i++){if(!_aNull(array[i].levelUniqueName)){m[array[i].levelUniqueName]=array[i]}}}return m};appliedLevelSortDirections=map(this.appliedLevelSortDirections());userLevelSortDirections=map(this.options.levelSortDirections);mergedLevelSortDirections=$.extend(userLevelSortDirections,appliedLevelSortDirections);mergedLevelSortDirections=$.map(mergedLevelSortDirections,function(sd){return sd});rowHeadersLayout=this._resolveRowHeadersLayout();viewSettings={compactRowHeaderIndentation:this.options.compactRowHeaderIndentation,isParentInFrontForColumns:this.options.isParentInFrontForColumns,treeRowHeaderIndentation:this.options.treeRowHeaderIndentation,isParentInFrontForRows:this.options.isParentInFrontForRows,compactColumnHeaders:this.options.compactColumnHeaders,rowHeadersLayout:rowHeadersLayout};hasColumns=dataSource.columnAxis().length>0;hasRows=dataSource.rowAxis().length>0;this._tableView=new $.ig.OlapTableView(dataSource.result(),hasColumns,hasRows,viewSettings);this._tableView.columnSortDirections(appliedColumnSortDirections);this._tableView.levelSortDirections(mergedLevelSortDirections);this._tableView.initialize();this._columnsChanged=false},_resolveRowHeadersLayout:function(){if(this.options.rowHeadersLayout!==undefined&&this.options.rowHeadersLayout!==null){return this.options.rowHeadersLayout}if(this.options.compactRowHeaders===true){return"superCompact"}return"standard"},_configureOptions:function(dataSource){var $this=this,cols,dataCols,data,settings,gridDataSource,options;this._rowsMatrix=new Matrix;this._fillMatrixWithHeaderCells(this._rowsMatrix,this._tableView.rowHeaders());this._maxMemberIndex=dataSource.columnAxis().length-1;cols=this._generateAllGridColumns(this._tableView.columnHeaders());dataCols=this._generateDataColumns(this._tableView.columnHeaders());data=this._transformGridData(this._tableView.resultCells(),dataCols,dataCols.length,this._rowsMatrix.length);settings={dataSource:data};gridDataSource=new $.ig.DataSource(settings);options={headerRendered:function(event,ui){if($this._ds){$this._onGridHeadersRendered(event,ui)}},dataRendered:function(event,ui){if($this._ds){$this._onDataRendered(event,ui)}}};$.extend(true,options,this.options.gridOptions);options.dataSource=gridDataSource;options.columns=cols;options.autoGenerateColumns=false;options.virtualization=false;options.fixedFooters=false;options.autoFormat=false;options.renderCheckBoxes=false;options.autoFitLastColumn=false;options.autoAdjustHeight=true;options.width=this.options.width;options.height=this.options.height;$.merge(options.features,[{name:"MultiColumnHeaders"}]);return options},_addSortingMarkup:function(sortingMarkupSettings){var sortMap=sortingMarkupSettings.sortMap,stringTemplate=sortingMarkupSettings.stringTemplate,sortDirection,replaceString=sortingMarkupSettings.replaceString,markup=sortingMarkupSettings.markup;if(sortingMarkupSettings.condition){sortDirection=sortMap[sortingMarkupSettings.axisName];if(sortDirection){sortDirection=sortDirection[sortingMarkupSettings.hierarchyOffset];if(sortDirection){sortDirection=sortDirection[sortingMarkupSettings.levelNumber]}}if(sortDirection==="ascending"){markup=markup.replace(stringTemplate,replaceString+"='ascending'");markup+=sortingMarkupSettings.ascIcon}else if(sortDirection==="descending"){markup=markup.replace(stringTemplate,replaceString+"='descending'");markup+=sortingMarkupSettings.descIcon}else if(this.options.allowHeaderRowsSorting){markup=markup.replace(stringTemplate,replaceString+"=''")}}else{markup=markup.replace(stringTemplate,"")}return markup},_fillMatrixWithHeaderCells:function(matrix,headerCells){var expandIcon,expandItemIcon,collapseIcon,collapseItemIcon,sortHeaderRowsAscendingIcon,sortHeaderRowsDescendingIcon,itemSortHeaderRowsAscendingIcon,itemSortHeaderRowsDescendingIcon,headerCell,levelSortDirectionsMap,headerMarkup,text,rowSpan,columnSpan,rowIndex,columnIndex,hierarchy,endNodeIndent,headerCellIndent,headerCellLinkIndent,axisName,tupleIndex,memberIndex,css,applyIndent,isExpandable,isItemExpandable,isExpanded,isItemExpanded,isTreeLayout,expandButtonMarkup,itemExpandButtonMarkup,indent,i,linkText,dataSource=this._ds,$this=this,expandedItems,sortingMarkupSettings;if(!headerCells||headerCells.length===0){matrix.set(0,0,"<th class='ui-iggrid-header ui-widget-header'></th>");return}expandIcon="<span data-expand='true' class='"+this.css.expandButton+"' style='margin-left: $$margin$$px;'></span>";collapseIcon="<span data-expand='false' class='"+this.css.collapseButton+"' style='margin-left: $$margin$$px;'></span>";expandItemIcon="<span data-item-expand='true' class='"+this.css.expandButton+"' style='margin-left: $$margin$$px;'></span>";collapseItemIcon="<span data-item-expand='false' class='"+this.css.collapseButton+"' style='margin-left: $$margin$$px;'></span>";sortHeaderRowsAscendingIcon="<span data-sortheader='asc' class='"+this.css.headerRowsAscending+"'></span>";sortHeaderRowsDescendingIcon="<span data-sortheader='desc' class='"+this.css.headerRowsDescending+"'></span>";itemSortHeaderRowsAscendingIcon="<span data-item-sortheader='asc' class='"+this.css.headerRowsAscending+"'></span>";itemSortHeaderRowsDescendingIcon="<span data-item-sortheader='desc' class='"+this.css.headerRowsDescending+"'></span>";isTreeLayout=this.options.rowHeadersLayout==="tree";if(isTreeLayout){expandedItems={};for(i=0;i<headerCells.length;i++){if(headerCells[i].isItemExpanded()){expandedItems[i]=headerCells[i].levelNumber()}}}levelSortDirectionsMap=this._tableView.appliedSortDirectionsMap();applyIndent=!(this.options.rowHeadersLayout==="standard"||this.options.rowHeadersLayout===null&&this.options.compactRowHeaders===false);for(i=0;i<headerCells.length;i++){headerCell=headerCells[i];text=headerCell.caption();rowSpan=headerCell.rowSpan();columnSpan=headerCell.columnSpan();rowIndex=headerCell.rowIndex();columnIndex=headerCell.columnIndex();axisName=headerCell.axisName();tupleIndex=headerCell.tupleIndex();memberIndex=headerCell.memberIndex();isExpandable=headerCell.isExpandable();isExpanded=headerCell.isExpanded();headerCellIndent=isTreeLayout?headerCell.indent():this.options.compactRowHeaderIndentation*headerCell.levelNumber();if(this.options.rowHeaderLinkGroupIndentation){headerCellLinkIndent=this.options.rowHeaderLinkGroupIndentation}if(isTreeLayout){isItemExpandable=headerCell.isItemExpandable();isItemExpanded=headerCell.isItemExpanded()}css="ui-iggrid-header ui-widget-header "+this.css.pivotGridHeader;headerMarkup="<th $$data-sortheader$$ $$data-item-sortheader$$ "+"class='"+css+"' "+"title='"+text+"' "+"data-skip='true' "+"rowspan='"+rowSpan+"' "+"colspan='"+columnSpan+"' "+"data-axis='"+axisName+"' "+"data-tuple='"+tupleIndex+"' "+"data-member='"+memberIndex+"'>";if(isItemExpandable){indent=applyIndent?headerCell.indent():0;itemExpandButtonMarkup=isItemExpanded?collapseItemIcon:expandItemIcon;itemExpandButtonMarkup=itemExpandButtonMarkup.replace("$$margin$$",indent);headerMarkup+=itemExpandButtonMarkup}if(isExpandable){if(isTreeLayout){headerMarkup+="<span class='ui-iggrid-headertext'>"+text+"</span>";sortingMarkupSettings={condition:isItemExpanded,sortMap:levelSortDirectionsMap,axisName:headerCell.axisName(),hierarchyOffset:headerCell.hierarchyNumber()+1,levelNumber:headerCell.levelNumber()-expandedItems[i],replaceString:"data-sortheader",stringTemplate:"$$data-sortheader$$",markup:headerMarkup,ascIcon:sortHeaderRowsAscendingIcon,descIcon:sortHeaderRowsDescendingIcon};headerMarkup=$this._addSortingMarkup(sortingMarkupSettings);expandButtonMarkup=isExpanded?collapseIcon:expandIcon;expandButtonMarkup=expandButtonMarkup.replace("$$margin$$",headerCellLinkIndent);headerMarkup+=expandButtonMarkup;hierarchy=dataSource.rowAxis()[headerCell.memberIndex()];linkText=dataSource.getCoreElement(function(element){return element.hierarchyUniqueName()===hierarchy.uniqueName()&&element.depth()===headerCell.levelNumber()+1},$.ig.Level.prototype.getType());if(linkText){headerMarkup+="<span class='ui-igpivot-rowheaderlink'>"+linkText.caption()+"</span>"}sortingMarkupSettings={condition:isExpanded,sortMap:levelSortDirectionsMap,axisName:headerCell.axisName(),hierarchyOffset:headerCell.hierarchyNumber(),levelNumber:headerCell.levelNumber(),replaceString:"data-item-sortheader",stringTemplate:"$$data-item-sortheader$$",markup:headerMarkup,ascIcon:itemSortHeaderRowsAscendingIcon,descIcon:itemSortHeaderRowsDescendingIcon};headerMarkup=$this._addSortingMarkup(sortingMarkupSettings)}else{indent=applyIndent?headerCellIndent:0;expandButtonMarkup=isExpanded?collapseIcon:expandIcon;expandButtonMarkup=expandButtonMarkup.replace("$$margin$$",indent);headerMarkup+=expandButtonMarkup;headerMarkup+="<span class='ui-iggrid-headertext' style='display:inline;'>"+text+"</span>";sortingMarkupSettings={condition:isExpanded,sortMap:levelSortDirectionsMap,axisName:headerCell.axisName(),hierarchyOffset:headerCell.hierarchyNumber(),levelNumber:headerCell.levelNumber(),replaceString:"data-sortheader",stringTemplate:"$$data-sortheader$$",markup:headerMarkup,ascIcon:sortHeaderRowsAscendingIcon,descIcon:sortHeaderRowsDescendingIcon};headerMarkup=$this._addSortingMarkup(sortingMarkupSettings)}}else if(!isTreeLayout||isTreeLayout&&itemExpandButtonMarkup&&itemExpandButtonMarkup.contains("$$margin$$")){indent=applyIndent?headerCellIndent:0;text="<span class='ui-iggrid-headertext' style='margin-left:"+indent+"px;'>"+text+"</span>";headerMarkup+=text}else{headerMarkup+="<span class='ui-iggrid-headertext'>"+text+"</span>"}if(isTreeLayout&&(isExpandable&&!isItemExpandable||!isExpandable&&!isItemExpandable)){indent=applyIndent?headerCellIndent:0;endNodeIndent=$(".ui-iggrid-headerbutton.ui-icon").eq(0).width()+indent;headerMarkup=headerMarkup.replace("class='ui-iggrid-headertext'","class='ui-iggrid-headertext' style='margin-left:"+endNodeIndent+"px;'")}sortingMarkupSettings={condition:isTreeLayout&&isItemExpanded&&headerMarkup.contains("$$data-item-sortheader$$"),sortMap:levelSortDirectionsMap,axisName:headerCell.axisName(),hierarchyOffset:headerCell.hierarchyNumber()+1,levelNumber:headerCell.levelNumber()-1>0?headerCell.levelNumber()-1:0,replaceString:"data-sortheader",stringTemplate:"$$data-item-sortheader$$",markup:headerMarkup,ascIcon:sortHeaderRowsAscendingIcon,descIcon:sortHeaderRowsDescendingIcon};headerMarkup=$this._addSortingMarkup(sortingMarkupSettings);sortingMarkupSettings={condition:isTreeLayout&&isItemExpanded&&headerMarkup.contains("$$data-item-sortheader$$"),sortMap:levelSortDirectionsMap,axisName:headerCell.axisName(),hierarchyOffset:headerCell.hierarchyNumber()+1,levelNumber:headerCell.levelNumber()-1>0?headerCell.levelNumber()-1:0,replaceString:"data-item-sortheader",stringTemplate:"$$data-item-sortheader$$",markup:headerMarkup,ascIcon:itemSortHeaderRowsAscendingIcon,descIcon:itemSortHeaderRowsDescendingIcon};headerMarkup=$this._addSortingMarkup(sortingMarkupSettings);headerMarkup+="</th>";matrix.set(rowIndex+rowSpan-1,columnIndex+columnSpan-1,undefined);matrix.set(rowIndex,columnIndex,headerMarkup)}},_generateAllGridColumns:function(headers){var cols,levels=[],i;if(!headers||headers.length===0){return[this._const.emptyCell]}for(i=0;i<headers.length;i++){if(!levels[headers[i].rowIndex()]){levels[headers[i].rowIndex()]=[]}levels[headers[i].rowIndex()].push(headers[i])}this._maxLevel=levels.length;cols=this._processHeadersTree(levels);return cols},_generateDataColumns:function(headers){var cols=[],i;if(!headers||headers.length===0){return[this._const.emptyCell]}for(i=0;i<headers.length;i++){if(headers[i].memberIndex()!==this._maxMemberIndex){continue}if(headers[i].columnSpan()===1&&(headers[i].isExpandable()===false||!headers[i].isExpanded())){cols.push({headerText:headers[i].caption(),key:headers[i].axisName()+"_"+headers[i].tupleIndex()+"_"+headers[i].memberIndex()+"_"+headers[i].isExpandable()})}else if(this.options.compactColumnHeaders){cols.push({headerText:headers[i].caption(),key:headers[i].axisName()+"_"+headers[i].tupleIndex()+"_"+headers[i].memberIndex()+"_"+headers[i].isExpandable()})}}return cols},_transformGridData:function(cells,columns,columnsCount,maxRowCount){var data=[],cellOrdinal,i,colIndex;if(!cells||cells.length===0){if(maxRowCount>0){for(i=0;i<maxRowCount;i++){data.push({})}return data}return[{}]}for(i=0;i<maxRowCount;i++){data.push({})}for(i=0;i<cells.length;i++){cellOrdinal=cells[i].cellOrdinal();colIndex=cellOrdinal%columnsCount;data[Math.floor(cellOrdinal/columnsCount)][columns[colIndex].key]=cells[i].formattedValue()}return data},_processHeadersTree:function(tree){var cols=[],i,j,parent,parents;for(i=0;tree.length>=1&&i<tree[0].length;i++){this._createHeader(cols,tree[0][i])}for(i=1;i<tree.length;i++){parents=this._parentsForLevel(i,cols);for(j=0;j<tree[i].length;j++){parent=this._findParent(parents,tree[i][j]);if(parent){this._createHeader(parent,tree[i][j])}else{if(i-1>=1){this._findAndCreateUp(i-1,i,cols,tree,tree[i][j])}}}}return cols},_findAndCreateUp:function(level,itemsLevel,cols,tree,item){var parents,j,currentItem,parent;parents=this._parentsForLevel(level,cols);for(j=0;j<tree[itemsLevel].length;j++){currentItem=tree[itemsLevel][j];if(currentItem.axisName()===item.axisName()&&currentItem.columnIndex()===item.columnIndex()&&currentItem.memberIndex()===item.memberIndex()&&currentItem.tupleIndex()===item.tupleIndex()&&currentItem.caption()===item.caption()){parent=this._findParent(parents,currentItem,itemsLevel-level+1);if(parent){this._createHeader(parent,currentItem)}else{if(level-1>=1){this._findAndCreateUp(level-1,itemsLevel,cols,tree,item)}}}}},_parentsForLevel:function(level,root){var parents=[],i;for(i=0;i<root.length;i++){this._parentsForLevelRecursive(parents,root[i],1,level)}return parents},_parentsForLevelRecursive:function(parents,currentParent,currentLevel,level){var extraLevel=currentParent.rowspan>1?currentParent.rowspan-1:0,i;if(currentLevel===level){parents.push(currentParent)}else if(currentLevel<level&&currentParent.group!==null&&currentParent.group!==undefined){for(i=0;i<currentParent.group.length;i++){this._parentsForLevelRecursive(parents,currentParent.group[i],currentLevel+1+extraLevel,level)}}},_createHeader:function(parent,col){var column={headerText:col.caption(),key:col.axisName()+"_"+col.tupleIndex()+"_"+col.memberIndex()+"_"+col.isExpandable(),rowspan:col.rowSpan(),colSpan:col.columnSpan(),colIndex:col.columnIndex(),axisName:col.axisName(),tupleIndex:col.tupleIndex(),memberIndex:col.memberIndex(),expandable:col.isExpandable(),expanded:col.isExpanded(),hierarchyNumber:col.hierarchyNumber(),levelNumber:col.levelNumber()};if(!this.options.compactColumnHeaders&&(col.columnSpan()>1||col.columnSpan()===1&&col.isExpanded()&&col.isExpandable())){column.group=[]}parent.push(column)},_findParent:function(cols,header,rowSpan){var i;if(!cols||cols.length===undefined||cols.length===null){return null}for(i=0;i<cols.length;i++){if(rowSpan===undefined||rowSpan!==undefined&&cols[i].rowspan===rowSpan){if(cols[i].colSpan+cols[i].colIndex>=header.columnSpan()+header.columnIndex()&&cols[i].colIndex<=header.columnIndex()){if(!cols[i].group){cols[i].group=[]}return cols[i].group}}}return null},grid:function(){return this.element.data(_igGrid)},updateGrid:function(){this._updateGrid(false,true)},_updateGrid:function(init,deferUpdateOverride){var dataSource=this._ds,container,shouldUpdate=deferUpdateOverride||this.options.deferUpdate===false,promise;if(!init&&!shouldUpdate){return}if(this.element.data(_igGrid)){container=this.grid().container();$("#"+this.grid().element.attr("id")+"_columns_overlay").css("display","none");$("#"+this.grid().element.attr("id")+"_measures_overlay").css("display","none");container.css("position","relative");$("<div class='"+this.css.blockArea+"'></div>").appendTo(container).data("efh","1")}if(init){promise=dataSource.initialize()}else{promise=dataSource.update()}return promise},_onGridUpdated:function(){var dataSource=this._ds,options;this._createTableView(dataSource);options=this._configureOptions(dataSource);this._renderGrid(options)},_renderEmptyGrid:function(){var options;options=$.extend(true,{},this.options.gridOptions);options.width=this.options.width;options.height=this.options.height;this.element.igGrid(options)},_renderGrid:function(options){var id=this.element.attr("id"),grid,container;grid=this.grid();if(grid){this._gridScrollOffsets.top=grid.scrollContainer().scrollTop();this._gridScrollOffsets.left=$("#"+id+"_hscroller").scrollLeft();this.element.igGrid("destroy");this.element.empty()}this.element.igGrid(options);container=this.grid().container();container.addClass(this.css.pivotGrid);this._makeDroppable(container)},_onGridHeadersRendered:function(event,ui){var $this=this,headers=ui.owner._oldCols,table=ui.table,id=this.element.attr("id"),appliedColumnSortDirectionsMap,first,firstParent,rowsCellColSpan,rowsCellRowSpan,columnsCellColSpan,filtersCellColSpan,row,droppableOptions,dropArea,header,dataSource=this._ds,extraColsCount,colgroup,col,i,length,sortableHeaders;table.addClass(this.css.pivotGrid);ui.owner._renderRecord=function(data,rowIndex){return $this._renderPivotRecord.call(this,$this._rowsMatrix,data,rowIndex)};if(headers===null||headers===undefined){headers=ui.owner.options.columns}appliedColumnSortDirectionsMap={};$.each(this._tableView.appliedColumnSortDirections(),function(ind,csd){appliedColumnSortDirectionsMap[csd.tupleIndex]=csd.sortDirection});this._processHeaderMarkupRecursive(this.grid().element[0].id,headers,appliedColumnSortDirectionsMap,this._tableView.appliedSortDirectionsMap());first=table.find("tr").first();firstParent=first.parent();rowsCellColSpan=this._rowsMatrix.length>0?this._rowsMatrix[0].length:1;rowsCellRowSpan=this._maxLevel;columnsCellColSpan=ui.owner.options.columns.length;filtersCellColSpan=rowsCellColSpan+columnsCellColSpan;if(table.find(".ui-igpivot-droparea[data-role=rows], .ui-igpivot-droparea[data-role=columns], .ui-igpivot-droparea[data-role=measures], .ui-igpivot-droparea[data-role=filters]").length===0){droppableOptions=this._createDropAreaOptions();if(!this.options.hideRowsDropArea){header=$("<th id='"+id+"_rows' rowSpan='"+rowsCellRowSpan+"' colSpan='"+rowsCellColSpan+"' data-skip='true' class='"+this.css.dropAreaHeader+"'></th>").prependTo(first);header.height(header.height());dropArea=$("<ul data-role='rows' class='"+this.css.dropArea+"'></ul>").appendTo(header);if(!this.options.disableRowsDropArea&&!$.ig.util.isTouchDevice()){dropArea.droppable(droppableOptions)}}else{$("<th rowSpan='"+rowsCellRowSpan+"' colSpan='"+rowsCellColSpan+"' data-skip='true' class='ui-iggrid-header ui-widget-header'></th>").prependTo(first)}if(!this.options.hideColumnsDropArea||!this.options.hideMeasuresDropArea){row=$("<tr></tr>").prependTo(firstParent)}if(!this.options.hideColumnsDropArea){header=$("<th id='"+id+"_columns' rowSpan='1' colSpan='"+columnsCellColSpan+"' data-skip='true' class='"+this.css.dropAreaHeader+"'></th>").prependTo(row);dropArea=$("<ul data-role='columns' class='"+this.css.dropArea+"'></ul>").appendTo(header);if(!this.options.disableColumnsDropArea&&!$.ig.util.isTouchDevice()){dropArea.droppable(droppableOptions);if($("#"+id+"_columns_overlay").length<1){$("<div id='"+id+"_columns_overlay' data-role='columns' class='"+this.css.overlayDropArea+" ui-igpivot-droparea ui-droppable'></div>").appendTo(this.element).droppable(droppableOptions)}}}else if(!this.options.hideMeasuresDropArea){$("<th rowSpan='1' colSpan='"+columnsCellColSpan+"' data-skip='true' class='ui-iggrid-header ui-widget-header'></th>").prependTo(row)}if(!this.options.hideMeasuresDropArea){header=$("<th id='"+id+"_measures' rowSpan='1' colSpan='"+rowsCellColSpan+"' data-skip='true' class='"+this.css.dropAreaHeader+"'></th>").prependTo(row);dropArea=$("<ul data-role='measures' class='"+this.css.dropArea+"'></ul>").appendTo(header);if(!this.options.disableMeasuresDropArea&&!$.ig.util.isTouchDevice()){dropArea.droppable(droppableOptions)}}else if(!this.options.hideColumnsDropArea){$("<th rowSpan='1' colSpan='"+rowsCellColSpan+"' data-skip='true' class='ui-iggrid-header ui-widget-header'></th>").prependTo(row)}if(!this.options.hideFiltersDropArea){row=$("<tr></tr>").prependTo(firstParent);header=$("<th id='"+id+"_filters' rowSpan='1' colSpan='"+filtersCellColSpan+"' data-skip='true' class='"+this.css.dropAreaHeader+"'></th>").prependTo(row);dropArea=$("<ul data-role='filters' class='"+this.css.dropArea+"'></ul>").appendTo(header);if(!this.options.disableFiltersDropArea&&!$.ig.util.isTouchDevice()){dropArea.droppable(droppableOptions)}}}else{$("#"+id+"_rows").attr("rowSpan",rowsCellRowSpan).attr("colSpan",rowsCellColSpan);$("#"+id+"_columns").attr("rowSpan",1).attr("colSpan",columnsCellColSpan);$("#"+id+"_measures").attr("rowSpan",1).attr("colSpan",rowsCellColSpan);$("#"+id+"_fiters").attr("rowSpan",1).attr("colSpan",filtersCellColSpan)}colgroup=table.find("colgroup");if(colgroup.length===0){if(this.grid()._isMultiColumnGrid){length=table.find("th[data-isheadercell]").length}else{length=headers.length}colgroup="<colgroup>";for(i=0;i<length;i++){colgroup+="<col></col>"}colgroup+="</colgroup>";colgroup=$(colgroup).prependTo(table)}extraColsCount=this._rowsMatrix.length>0?this._rowsMatrix[0].length:1;for(i=0;i<extraColsCount;i++){col=$("<col></col>").prependTo(colgroup).attr("data-skip","true")}if(extraColsCount){colgroup.attr("data-cols-injected","true")}if(this.options.allowSorting){sortableHeaders=table.find(".ui-igpivotgrid-header[data-sort]");sortableHeaders.children(".ui-iggrid-headertext,.ui-iggrid-sortindicator").bind("click",function(evt){$this._onSort(evt)
});sortableHeaders.filter("[data-axis='empty_axis']").bind("click",function(evt){$this._onSort(evt)})}if(this.options.allowHeaderColumnsSorting){table.find(".ui-igpivotgrid-header[data-sortheader]").children(".ui-iggrid-headertext,.ui-iggrid-sortindicator").bind("click",function(evt){$this._onSortHeader(evt)})}if(!this.options.hideFiltersDropArea){this._fillDropArea("#"+id+"_filters .ui-igpivot-droparea",dataSource.filters(),this.options.disableFiltersDropArea,this.options.disableFiltersDropArea?$.ig.PivotGrid.locale.disabledFiltersHeader:$.ig.PivotGrid.locale.filtersHeader)}if(!this.options.hideRowsDropArea){this._fillDropArea("#"+id+"_rows .ui-igpivot-droparea",dataSource.rowAxis(),this.options.disableRowsDropArea,this.options.disableRowsDropArea?$.ig.PivotGrid.locale.disabledRowsHeader:$.ig.PivotGrid.locale.rowsHeader)}if(!this.options.hideColumnsDropArea){this._fillDropArea("#"+id+"_columns .ui-igpivot-droparea",dataSource.columnAxis(),this.options.disableColumnsDropArea,this.options.disableColumnsDropArea?$.ig.PivotGrid.locale.disabledColumnsHeader:$.ig.PivotGrid.locale.columnsHeader)}if(!this.options.hideMeasuresDropArea){this._fillDropArea("#"+id+"_measures .ui-igpivot-droparea",dataSource.measures(),this.options.disableMeasuresDropArea,this.options.disableMeasuresDropArea?$.ig.PivotGrid.locale.disabledMeasuresHeader:$.ig.PivotGrid.locale.measuresHeader)}this._measureHeaders(headers);table.find("thead span.ui-iggrid-headerbutton.ui-icon").bind("click",function(evt){$this._onToggleTupleMember(evt);return false});this._triggerPivotGridHeadersRendered(event,ui)},_renderPivotRecord:function(matrix,data,rowIndex){var i,key=this.options.primaryKey,temp,grid=this,dstr="",cols=this.options.columns,noVisibleColumns,str="";dstr+="<tr";if(rowIndex%2!==0&&this.options.alternateRowStyles){dstr+=" class='"+grid.css.recordAltClass+"'"}if(!_aNull(key)){dstr+=" data-id='"+this._kval_from_key(key,data)+"'"}else if(!_aNull(data.ig_pk)){dstr+=" data-id='"+data.ig_pk+"'"}if(this.options.virtualization&&this.options.virtualizationMode==="continuous"){dstr+=" data-row-idx='"+rowIndex+"'"}dstr+=" role='row'>";for(i=0;i<matrix[rowIndex].length;i++){if(matrix[rowIndex][i]){str+=matrix[rowIndex][i]}}if(str!==""){dstr+=str}noVisibleColumns=true;$(cols).each(function(colIndex){if(cols[colIndex].hidden||cols[colIndex].fixed===true){return}noVisibleColumns=false;dstr+='<td role="gridcell" aria-describedby="'+grid.id()+"_"+this.key+'" tabindex="'+grid.options.tabIndex+'"';if(cols[colIndex].template&&cols[colIndex].template.length){temp=grid._renderTemplatedCell(data,this);if(temp.indexOf("<td")===0){dstr+=temp.substring(3)}else{dstr+=">"+temp}dstr=grid._editCellStyle(dstr,data,this.key)}else{dstr+=grid._addCellStyle(data,this.key?this.key:colIndex,cols[colIndex])+">"+grid._renderCell(data[this.key?this.key:colIndex],this,data)}dstr+="</td>"});if(noVisibleColumns){dstr+="<td role='gridcell'></td>"}dstr+="</tr>";return dstr},_processHeaderMarkupRecursive:function(tableId,headers,columnSortDirectionsMap,levelSortDirectionsMap){var i,headerCell,expanded,expandable,sortDirection,expandIcon,collapseIcon,allowSorting,allowHeaderColumnsSorting,sortRowsAscendingIcon,sortRowsDescendingIcon,sortHeaderColumnsAscendingIcon,sortHeaderColumnsDescendingIcon;allowSorting=this.options.allowSorting;allowHeaderColumnsSorting=this.options.allowHeaderColumnsSorting;expandIcon="<span data-expand='true' class='"+this.css.expandButton+"'/>";collapseIcon="<span data-expand='false' class='"+this.css.collapseButton+"'/>";sortRowsAscendingIcon="<span data-sort='asc' class='"+this.css.rowsAscending+"'/>";sortRowsDescendingIcon="<span data-sort='desc' class='"+this.css.rowsDescending+"'/>";sortHeaderColumnsAscendingIcon="<span data-sortheader='asc' class='"+this.css.headerColumnsAscending+"'></span>";sortHeaderColumnsDescendingIcon="<span data-sortheader='desc' class='"+this.css.headerColumnsDescending+"'></span>";for(i=0;i<headers.length;i++){headerCell=$("#"+tableId+"_"+headers[i].key);headerCell.addClass(this.css.pivotGridHeader).attr("data-axis",headers[i].axisName).attr("data-member",headers[i].memberIndex).attr("data-tuple",headers[i].tupleIndex);if(headers[i].axisName!==this._const.emptyCell.axisName){headerCell.attr("title",headers[i].headerText)}if(this.options.compactColumnHeaders&&headers[i].levelNumber>0){headerCell.css("padding-top",this.options.compactColumnHeaderIndentation*headers[i].levelNumber)}expandable=headers[i].expandable;expanded=headers[i].expanded;if(expandable&&!expanded){$(expandIcon).insertBefore(headerCell.children(".ui-iggrid-headertext"))}else if(expandable&&expanded){$(collapseIcon).insertBefore(headerCell.children(".ui-iggrid-headertext"));sortDirection=levelSortDirectionsMap[headers[i].axisName];if(sortDirection){sortDirection=sortDirection[headers[i].hierarchyNumber];if(sortDirection){sortDirection=sortDirection[headers[i].levelNumber]}}if(sortDirection==="ascending"){headerCell.attr("data-sortheader","ascending");$(sortHeaderColumnsAscendingIcon).appendTo(headerCell)}else if(sortDirection==="descending"){headerCell.attr("data-sortheader","descending");$(sortHeaderColumnsDescendingIcon).appendTo(headerCell)}else if(allowHeaderColumnsSorting){headerCell.attr("data-sortheader","")}}if(!expandable||expandable&&!expanded){sortDirection=columnSortDirectionsMap[headers[i].tupleIndex];if(sortDirection==="ascending"){headerCell.attr("data-sort","ascending");$(sortRowsAscendingIcon).appendTo(headerCell)}else if(sortDirection==="descending"){headerCell.attr("data-sort","descending");$(sortRowsDescendingIcon).appendTo(headerCell)}else if(allowSorting){headerCell.attr("data-sort","")}}if(headers[i].group){this._processHeaderMarkupRecursive(tableId,headers[i].group,columnSortDirectionsMap,levelSortDirectionsMap)}}},_fillDropArea:function(dropAreaSelector,items,isDisabled,emptyMessage){var dropArea=$(dropAreaSelector),i,length;dropArea.empty();if(items.length>0){for(i=0,length=items.length;i<length;i++){this._createMetadataElement(items[i],isDisabled,"appendTo",dropArea)}}else{dropArea.text(emptyMessage)}},_measureHeaders:function(headers){var $this=this,id=this.element.attr("id"),grid=this.grid(),table=grid.headersTable(),extraColsCount,extraColsWidth,maxWidth,header,measureTh,colsWidth;extraColsCount=this._rowsMatrix.length>0?this._rowsMatrix[0].length:1;if(this.options.defaultRowHeaderWidth){table.find("col:lt("+extraColsCount+")").width(this.options.defaultRowHeaderWidth);if(!$.ig.util.isTouchDevice()){table.find(".ui-igpivot-droparea[data-role=rows], .ui-igpivot-droparea[data-role=columns], .ui-igpivot-droparea[data-role=measures], .ui-igpivot-droparea[data-role=filters]").each(function(){$this._measureDropArea($(this))})}else{table.find(".ui-igpivot-droparea[data-role=rows], .ui-igpivot-droparea[data-role=columns], .ui-igpivot-droparea[data-role=measures], .ui-igpivot-droparea[data-role=filters]").each(function(ind,el){$(el).wrap($("<div style='overflow: hidden;'></div>")).parent("div").igScroll()})}extraColsWidth=this.options.defaultRowHeaderWidth*extraColsCount}else{maxWidth=0;table.find("#"+id+"_measures, #"+id+"_rows").each(function(ind,el){var clone,parent;clone=$(el).clone(false);clone.children(".ui-igpivot-droparea").append("<li class='"+$this.css.insertItem+"'></li>");parent=$("<div class='ui-widget ui-widget-header ui-iggrid ui-igpivotgrid'></div>").append(clone).css({position:"absolute",visibility:"hidden",height:"auto",width:"auto",overflow:"visible","text-overflow":"clip",left:"-1000px",top:"-1000px"}).appendTo(document.body);maxWidth=Math.max(maxWidth,parent.outerWidth(true));parent.remove()});table.find("col:lt("+extraColsCount+")").width(Math.ceil(maxWidth/extraColsCount));extraColsWidth=maxWidth}if(grid.options.defaultColumnWidth){table.find("col:gt("+extraColsCount+")").width(grid.options.defaultColumnWidth)}else{header=table.find("th:not(.ui-igpivot-dropareaheader):first");measureTh=$("<th class='"+header.attr("class")+"' style='position:absolute;visibility:hidden;height:auto;width:auto;overflow:visible;text-overflow:clip;left:-1000px;top:-1000px;'></th>").css({"font-family":header.css("fontFamily"),"font-size":header.css("fontSize"),"font-size-adjust":header.css("fontSizeAdjust"),"font-stretch":header.css("fontStretch"),"font-style":header.css("fontStyle"),"font-variant":header.css("fontVariant"),"font-weight":header.css("fontWeight")}).appendTo(document.body);colsWidth=this._measureHeadersRecursive(this.grid().element[0].id,headers,measureTh,extraColsCount);measureTh.remove()}if(table.find("col").length-extraColsCount===1||extraColsWidth+colsWidth<table.width()){table.find("col:last").width("auto")}},_measureHeadersRecursive:function(tableId,headers,measureTh,extraColsCount){var i,headerCell,totalWidth,width;totalWidth=0;for(i=0;i<headers.length;i++){if(headers[i].axisName===this._const.emptyCell.axisName){break}headerCell=$("#"+tableId+"_"+headers[i].key);if(headers[i].group){totalWidth+=this._measureHeadersRecursive(tableId,headers[i].group,measureTh,extraColsCount)}else{width=measureTh.html(headerCell[0].innerHTML)[0].offsetWidth+10;totalWidth+=width;this.grid().headersTable().find("col:eq("+(headerCell.data("columnIndex")+extraColsCount)+")").width(width);headers[i].width=width}}return totalWidth},_measureDropArea:function(dropArea){var $this=this,id,parent,parentClone,parentContainer,parentWidth,left,minLeft,maxLeft,scrollLeft,scrollRight,scrollToLeft,timer,mouseover,mouseout;parent=dropArea.parent("th");id=parent.attr("id");parentClone=$(parent).clone(false);parentClone.children(".ui-igpivot-droparea").append("<li class='"+$this.css.insertItem+"'></li>");parentContainer=$("<div class='ui-widget ui-widget-header ui-iggrid ui-igpivotgrid'></div>").append(parentClone).css({position:"absolute",visibility:"hidden",height:"auto",width:"auto",overflow:"visible","text-overflow":"clip",left:"-1000px",top:"-1000px"}).appendTo(document.body);parentWidth=parent.width();if(parentContainer.find(".ui-igpivot-droparea").outerWidth(true)>parentWidth){dropArea.css({display:"inline-block",overflow:"hidden",margin:0,padding:0});scrollLeft=$("<span class='"+this.css.scrollButton+"'><a class='"+this.css.scrollLeft+"' /></span>").insertBefore(dropArea);scrollRight=$("<span class='"+this.css.scrollButton+"'><a class='"+this.css.scrollRight+"' /></span>").insertAfter(dropArea);if(0===parentWidth){dropArea.width("auto")}else{dropArea.width(parentWidth-scrollLeft.outerWidth(true)-scrollRight.outerWidth(true))}left=this._headerScrollOffsets[id]||0;minLeft=0;maxLeft=dropArea[0].scrollWidth;scrollToLeft=function(){if(left<minLeft){left=minLeft}if(left>maxLeft){left=maxLeft}dropArea.scrollLeft(left);$this._headerScrollOffsets[id]=left};scrollToLeft();mouseover=this._getEvent("mouseover");mouseout=this._getEvent("mouseout");scrollLeft.bind(mouseover,function(){timer=setInterval(function(){left-=$this._const.hoverScrollOffset;scrollToLeft()},$this._const.hoverScrollInterval)}).bind(mouseout,function(){clearInterval(timer)});scrollRight.bind(mouseover,function(){timer=setInterval(function(){left+=$this._const.hoverScrollOffset;scrollToLeft()},$this._const.hoverScrollInterval)}).bind(mouseout,function(){clearInterval(timer)})}else{delete this._headerScrollOffsets[id]}parentContainer.remove()},_getKPIs:function(dataSource){var measures,kpi,kpiObject,KPIs=[],i;measures=dataSource.measures();for(i=measures.length-1;i>=0;i--){kpiObject={};if("KpiMeasure"===measures[i].getType().typeName()){kpi=dataSource.getCoreElements(function(el){return el.uniqueName()===measures[i].uniqueName()},$.ig.KpiMeasure.prototype.getType())}if(undefined!==kpi&&1===kpi.length){if(null!==kpi[0].graphic()){kpiObject.name=kpi[0].caption();kpiObject.graphic=kpi[0].graphic();KPIs.push(kpiObject)}}}return KPIs},_getKPICells:function(KPIs,dataSource){var headers,allColumns,columnIndexes,rowCells,allRows,i,j,k,m,rowspan,colspan,colspanValue,colspanOffset,rows;if(0!==KPIs.length){if(1===dataSource.measures().length){KPIs[0].cells=$("."+this.css.pivotGrid+" td")}else{for(m=KPIs.length-1;m>=0;m--){KPIs[m].cells=$();headers=$();headers=headers.add("th.ui-igpivotgrid-header[title='"+KPIs[m].name+"']");switch(dataSource.getMeasureListLocation()){case"rows":for(k=0;k<headers.length;k++){rowspan=parseInt(headers.eq(k).attr("rowspan"),10);rows=headers.eq(k).parent();for(i=0;i<rowspan;i++){for(j=0;j<rows.find("td").length;j++){KPIs[m].cells=KPIs[m].cells.add(rows.find("td").eq(j)[0])}rows=rows.next()}}break;case"columns":colspanOffset=0;columnIndexes=[];allColumns=headers.parent().find("th[data-skip!=true]");for(i=0,j=0;i<allColumns.length;i++){colspanValue=parseInt(allColumns.eq(i).attr("colspan"),10);colspan=isNaN(colspanValue)?1:colspanValue;if(allColumns.eq(i)[0]===headers.eq(j)[0]){for(k=0;k<colspan;k++){columnIndexes.push(i+k+colspanOffset)}j++}colspanOffset+=colspan>1?colspan-1:0}allRows=$("."+this.css.pivotGrid+" tbody tr");rowCells=allRows.find("td");for(i=0;i<allRows.length;i++){for(j=0,k=0;j<rowCells.length;j++){if(j===columnIndexes[k]){KPIs[m].cells=KPIs[m].cells.add(allRows.eq(i).find("td").eq(j)[0]);k++}}}break}}}return KPIs}return[]},_addKPIImages:function(KPIs){var i,j,imgString,currentCell,val,x,y;for(i=0;i<KPIs.length;i++){for(j=0;j<KPIs[i].cells.length;j++){currentCell=KPIs[i].cells.eq(j);if(!isNaN(currentCell.text())){imgString="<div class='ui-igpivotgrid-kpis'";imgString+=" title='"+currentCell.text()+"'";imgString+=" style='background-position: ";val=parseFloat(currentCell.text());if(0<val){x=0}else if(0>val){x=32}else{x=16}switch(KPIs[i].graphic.toLowerCase()){case"road signs":y=0;break;case"traffic light":y=16;break;case"variance arrow":y=32;break;case"standart arrow":y=48;break;case"status arrow - ascending":y=64;break;case"status arrow - descending":y=80;break;case"faces":y=96;break;case"shapes":y=112;break;case"cylinder":y=128;break;case"gauge - ascending":y=144;break;case"gauge - descending":y=160;break;case"thermometer":y=176;break}imgString+="-"+x+"px -"+y+"px";imgString+="'></div>";KPIs[i].cells.eq(j)[0].innerHTML=imgString}}}},_adjustRowHeadersWidth:function(grid){var maxWidth=0,childrenWidth,headers,headerChildren,rowsDropAreaWidth,row;if(this.options.height!==null){headers=grid.element.find("th")}else{headers=grid.headersTable().find("tbody th")}headers.each(function(){childrenWidth=parseInt($(this).css("border-right-width").replace("px",""),10);headerChildren=$(this).children();headerChildren.each(function(){childrenWidth+=parseInt($(this).css("margin-left").replace("px",""),10);childrenWidth+=$(this).width()});maxWidth=maxWidth<childrenWidth?childrenWidth:maxWidth});grid.headersTable().find("col").eq(0).width(maxWidth+headers.outerWidth()-headers.width());row="#"+this.element[0].id+"_rows";rowsDropAreaWidth=$(row).width()-2*$(row+" span").width();$(row+" ul").width(rowsDropAreaWidth)},_onDataRendered:function(event,ui){var $this=this,id=this.element.attr("id"),table=ui.owner.element,grid=this.grid(),overlayDropAreaOptions=this._createDropAreaOptions(),dataSource=this._ds,headersCols,colgroup,i,j,colAttributes,KPIs,headerCell,sortableItems,headerCells,headerItemCells;if($this.options.rowHeadersLayout==="tree"&&!$this.options.defaultRowHeaderWidth&&this._ds.rowAxis().length!==0){$this._adjustRowHeadersWidth(grid)}if("OlapXmlaDataSource"===dataSource.getType().typeName()){KPIs=this._getKPIs(dataSource);KPIs=this._getKPICells(KPIs,dataSource);this._addKPIImages(KPIs,dataSource)}table.addClass(this.css.pivotGrid);table.find("tbody th > span[data-expand]").bind("click",function(evt){$this._onToggleTupleMember(evt);return false});table.find("tbody th > span[data-item-expand]").bind("click",function(evt){$this._onToggleTupleMember(evt);return false});if(this.options.allowHeaderRowsSorting){if(this.options.rowHeadersLayout==="tree"){headerCell="tbody th.ui-igpivotgrid-header[data-item-sortheader],tbody th.ui-igpivotgrid-header[data-sortheader]";sortableItems=".ui-iggrid-sortindicator";headerItemCells=table.find(headerCell).find("span[data-item-expand]");for(i=0;i<headerItemCells.length;i++){if($(headerItemCells[i]).data().itemExpand===false){sortableItems+=",.ui-iggrid-headertext:eq("+i+")"}}headerCells=table.find(headerCell).find("span[data-expand]");for(i=0;i<headerCells.length;i++){if($(headerCells[i]).data().expand===false){sortableItems+=",.ui-igpivot-rowheaderlink:eq("+i+")"}}}else{headerCell="tbody th.ui-igpivotgrid-header[data-sortheader]";sortableItems=".ui-iggrid-headertext,.ui-iggrid-sortindicator"}table.find(headerCell).children(sortableItems).bind("click",function(evt){$this._onSortHeader(evt)})}if(grid.options.fixedHeaders){headersCols=grid.headersTable().find("colgroup").find("col");colgroup=table.find("colgroup");colgroup.empty();for(i=0;i<headersCols.length;i++){colgroup.append($("<col></col>"));colAttributes=headersCols.eq(i)[0].attributes;for(j=0;j<colAttributes.length;j++){colgroup.find("col").eq(i).attr(colAttributes.item(j).name,colAttributes.item(j).value)}}grid._setGridContentWidth(grid.headersTable().width());grid.scrollContainer().scrollTop(this._gridScrollOffsets.top);$("#"+id+"_hscroller").scrollLeft(this._gridScrollOffsets.left)}if(!this.options.disableRowsDropArea&&!$.ig.util.isTouchDevice()){if($("#"+id+"_rows_overlay").length<1){$("<div id='"+id+"_rows_overlay' data-role='rows' class='"+this.css.overlayDropArea+" ui-igpivot-droparea ui-droppable'></div>").appendTo(this.element).droppable(overlayDropAreaOptions)}}if(!this.options.disableMeasuresDropArea&&!$.ig.util.isTouchDevice()){if($("#"+id+"_measures_overlay").length<1){$("<div id='"+id+"_measures_overlay' data-role='measures' class='"+this.css.overlayDropArea+" ui-igpivot-droparea ui-droppable'></div>").appendTo(this.element).droppable(overlayDropAreaOptions)}}this._positionOverlayDropAreas();this._triggerPivotGridRendered(event,ui)},_positionOverlayDropAreas:function(){var id=this.element.attr("id"),headersTable=this.grid().headersTable().find("thead"),dataTable=this.grid().element.find("tbody"),firstColumnHeaderPosition,firstRowHeaderPosition,columnHeadersHeight,rowHeadersWidth,measuresArea,container,containerParent,containerPosition,columnsOverlayTop,columnsOverlayLeft,columnHeadersWidth,measuresHeadersWidth,dataTableHeight,rowsOverlayTop,rowsOverlayLeft,containerId,rowHeight,ht,firstRow,rowsProps,columnsProps,measuresProps,absoluteOffset;firstColumnHeaderPosition=headersTable.find("th[data-axis]:first").position();columnHeadersHeight=0;if($.ig.util.isFF){columnHeadersHeight=headersTable.find("tr[data-header-row], tr[data-mch-level]")[0].scrollHeight}else{headersTable.find("tr[data-header-row], tr[data-mch-level]").each(function(ind,el){columnHeadersHeight+=el.scrollHeight})}if(this.options.height!==null||this.options.width!==null){containerId=this.element.attr("id");container=$("#"+containerId+"_container").length===1?$("#"+containerId+"_container"):$("#"+containerId+"_table_container");containerParent=container.parent();containerPosition=container.position()}if(this.options.height!==null){firstRowHeaderPosition={top:this.grid().headersTable().height()+containerPosition.top,left:containerPosition.left}}else if(this.options.width!==null){rowHeight=this.grid().headersTable().find("tr").eq(0).height();if(this.grid().headersTable().find("tr[data-mch-level]").length===0){firstRowHeaderPosition={top:3*rowHeight+containerPosition.top,left:containerPosition.left}}else{firstRowHeaderPosition={top:2*rowHeight+this.grid().headersTable().find("tr[data-mch-level]").length*this.grid().headersTable().find("tr[data-mch-level]").eq(0).height()+containerPosition.top,left:containerPosition.left}}}if(this.options.height!==null||this.options.width!==null){columnsOverlayTop=firstColumnHeaderPosition.top+containerPosition.top+2*parseInt(containerParent.css("paddingTop")[0].replace("px",""),10);columnsOverlayLeft=firstColumnHeaderPosition.left+containerPosition.left;rowsOverlayTop=firstRowHeaderPosition.top+2*parseInt(containerParent.css("paddingTop")[0].replace("px",""),10);rowsOverlayLeft=firstRowHeaderPosition.left}else{firstRowHeaderPosition=this.grid().headersTable().find("tbody tr:first").position();columnsOverlayTop=firstColumnHeaderPosition.top+headersTable.parent().parent().position().top;columnsOverlayLeft=firstColumnHeaderPosition.left+headersTable.parent().parent().position().left;rowsOverlayTop=firstRowHeaderPosition.top+headersTable.parent().parent().position().top;rowsOverlayLeft=firstRowHeaderPosition.left+headersTable.parent().parent().position().left}if(this.options.hideRowsDropArea&&this.options.hideColumnsDropArea&&this.options.hideMeasuresDropArea&&this.options.hideFiltersDropArea){firstRow=headersTable.find("tr").eq(0).find("th")}else{firstRow=headersTable.find("tr").eq(1).find("th")}ht=firstRow.eq(1);if(headersTable[0].scrollWidth<=this.element.width()){columnHeadersWidth=ht.width()+2*(parseInt(ht.css("paddingLeft")[0].substr(0),10)+parseInt(ht.css("borderLeftWidth")[0].substr(0),10))}else{columnHeadersWidth=ht.width()+2*(parseInt(ht.css("paddingLeft")[0].substr(0),10)+parseInt(ht.css("borderLeftWidth")[0].substr(0),10))-(headersTable[0].scrollWidth-this.element.width())}measuresArea=firstRow.eq(0);dataTableHeight=this.element.height()-rowsOverlayTop>dataTable[0].scrollHeight?dataTable[0].scrollHeight:this.element.height()-headersTable.height();rowHeadersWidth=measuresArea.width()+2*(parseInt(measuresArea.css("paddingLeft")[0].replace("px",""),10)+parseInt(measuresArea.css("borderLeftWidth")[0].replace("px",""),10));if(headersTable[0].scrollWidth<=this.element.width()){measuresHeadersWidth=dataTable[0].scrollWidth-rowHeadersWidth}else{measuresHeadersWidth=dataTable[0].scrollWidth-rowHeadersWidth-(headersTable[0].scrollWidth-this.element.width())}absoluteOffset=this._calculateOffset(this.element);rowsProps={top:rowsOverlayTop+absoluteOffset.top,left:absoluteOffset.left,width:rowHeadersWidth,height:dataTableHeight};columnsProps={top:columnsOverlayTop+absoluteOffset.top,left:rowHeadersWidth+absoluteOffset.left,width:columnHeadersWidth,height:columnHeadersHeight};measuresProps={top:rowsOverlayTop+absoluteOffset.top,left:rowHeadersWidth+absoluteOffset.left,width:measuresHeadersWidth,height:dataTableHeight};$("#"+id+"_rows_overlay").css(rowsProps);$("#"+id+"_columns_overlay").css(columnsProps);$("#"+id+"_measures_overlay").css(measuresProps);headersTable.parent().parent().on("scroll",{table:headersTable,id:id,rowHeadersWidth:rowHeadersWidth,columnHeadersWidth:columnHeadersWidth,rowsOverlayLeft:rowsOverlayLeft,measuresHeadersWidth:measuresHeadersWidth,columnsOverlayLeft:columnsOverlayLeft},this._handlePivotGridScrolling)},_calculateOffset:function(jQueryObj){var el=jQueryObj,offset={top:0,left:el.offset().left};while(el[0].tagName&&el.scrollParent()[0].firstChild.name!=="html"){offset.top+=el.scrollParent().scrollTop();offset.left+=el.scrollParent().scrollLeft();el=el.scrollParent()}return offset},_handlePivotGridScrolling:function(evt){var scrollTable=evt.data.table.parent().parent(),id=evt.data.id,offset=scrollTable.scrollLeft(),rowHeadersWidth=evt.data.rowHeadersWidth,columnHeadersWidth=evt.data.columnHeadersWidth,rowsOverlayLeft=evt.data.rowsOverlayLeft,measuresHeadersWidth=evt.data.measuresHeadersWidth,columnsOverlayLeft=evt.data.columnsOverlayLeft;$("#"+id+"_columns_overlay").css({left:columnsOverlayLeft-(rowHeadersWidth>offset?offset:rowHeadersWidth),width:rowHeadersWidth>offset?columnHeadersWidth+offset:scrollTable.width()});$("#"+id+"_rows_overlay").css({width:rowHeadersWidth-offset});$("#"+id+"_measures_overlay").css({left:rowsOverlayLeft+rowHeadersWidth-(rowHeadersWidth>offset?offset:rowHeadersWidth),width:rowHeadersWidth>offset?measuresHeadersWidth+offset:scrollTable.width()})},_updateDataSource:function(deferUpdateOverride){this._updateGrid(false,deferUpdateOverride)},_shouldAppendToTarget:function(target,dragged){return target.offset().left+target.width()/2<dragged.offset.left+this._const.dragCursorAt.left},_onToggleTupleMember:function(evt){var $this=this,target=$(evt.target),header=target.closest("th"),axisName,memberIndex,tupleIndex,expand,noCancel;if(!(this._ds.dataSource().measures().inner().count()>1&&this.options.rowHeadersLayout==="tree"&&this._ds.dataSource().measureListLocation()===0)&&(this._performsToggle||this._ds.isModified())){return}axisName=header.attr("data-axis");memberIndex=parseInt(header.attr("data-member"),10);tupleIndex=parseInt(header.attr("data-tuple"),10);expand=target.attr("data-expand")==="true";if($this.options.rowHeadersLayout==="tree"&&target.attr("data-item-expand")){expand=target.attr("data-item-expand")==="true";memberIndex+=1}if(expand){noCancel=this._triggerTupleMemberExpanding(evt,axisName,memberIndex,tupleIndex);if(noCancel){this._ds.expandTupleMember(axisName,tupleIndex,memberIndex);this._performsToggle=true;this._updateGrid(false,true).done(function(){$this._triggerTupleMemberExpanded(null,axisName,memberIndex,tupleIndex)}).always(function(){$this._performsToggle=false})}}else{noCancel=this._triggerTupleMemberCollapsing(evt,axisName,memberIndex,tupleIndex);if(noCancel){this._ds.collapseTupleMember(axisName,tupleIndex,memberIndex);this._performsToggle=true;this._updateGrid(false,true).done(function(){$this._triggerTupleMemberCollapsed(evt,axisName,memberIndex,tupleIndex)}).always(function(){$this._performsToggle=false})}}},_onSort:function(evt){var $this=this,header=$(evt.target).closest("th"),axisName,tupleIndex,tupleIdentifier,axis,axes,tuple,memberNames,columnSortDirections,columnSortDirection,levelSortDirections,options,i,noCancel,en;if(this._ds.isModified()){return}axisName=header.attr("data-axis");tupleIndex=parseInt(header.attr("data-tuple"),10);if(axisName!==this._const.emptyCell.axisName){axes=this._ds.result().axes().__inner;for(i=0;i<axes.length;i++){if(axisName===axes[i].name()){axis=axes[i];break}}if(!axis){return}tuple=axis.tuples().item(tupleIndex);memberNames=[];en=tuple.members().getEnumerator();while(en.moveNext()){memberNames.push(en.current().uniqueName())}tupleIdentifier=memberNames.join("|")}else{memberNames=null;tupleIdentifier=""}columnSortDirections=this._tableView.columnSortDirections();for(i=0;i<columnSortDirections.length;i++){if(columnSortDirections[i].memberNames&&columnSortDirections[i].memberNames.join("|")===tupleIdentifier||columnSortDirections[i].tupleIndex===tupleIndex){columnSortDirection=columnSortDirections[i];break}}if(!evt.ctrlKey){columnSortDirections=[]}if(columnSortDirection){columnSortDirection.sortDirection=columnSortDirection.sortDirection==="ascending"?"descending":"ascending";if(!evt.ctrlKey){columnSortDirections.push(columnSortDirection)}}else{columnSortDirection={memberNames:memberNames,tupleIndex:tupleIndex,sortDirection:this.options.firstSortDirection};columnSortDirections.push(columnSortDirection)}noCancel=this._triggerSorting(evt,columnSortDirections);if(noCancel){levelSortDirections=$.grep(this._tableView.levelSortDirections(),function(sortDirection){var level,hierarchyName;level=$this._ds.getCoreElement(function(l){return l.uniqueName()===sortDirection.levelUniqueName},$.ig.Level.prototype.getType());if(level){hierarchyName=level.hierarchyUniqueName();return $.grep($this._ds.rowAxis(),function(h){return h.uniqueName()===hierarchyName}).length===0}return false});this._tableView.levelSortDirections(levelSortDirections);this._tableView.columnSortDirections(columnSortDirections);this._tableView.initialize();options=this._configureOptions(this._ds);this._renderGrid(options);this._triggerSorted(evt,columnSortDirections,this._tableView.appliedColumnSortDirections())}},_onSortHeader:function(evt){var header=$(evt.target).closest("th"),axisName,tupleIndex,memberIndex,axis,axes,tuple,member,level,levelName,hierarchyName,levelSortDirections,levelSortDirection,options,i,noCancel;if(this._ds.isModified()){return}axisName=header.attr("data-axis");tupleIndex=parseInt(header.attr("data-tuple"),10);memberIndex=parseInt(header.attr("data-member"),10);if(!header.hasClass("ui-iggrid-multiheader-cell")&&this.options.rowHeadersLayout==="tree"&&($(evt.target).hasClass("ui-iggrid-headertext")||$(evt.target).attr("data-sortheader"))){memberIndex+=1}axes=this._ds.result().axes().__inner;for(i=0;i<axes.length;i++){if(axisName===axes[i].name()){axis=axes[i];break}}if(!axis){return}tuple=axis.tuples().item(tupleIndex);member=tuple.members().item(memberIndex);level=this._ds.getCoreElement(function(l){return l.hierarchyUniqueName()===member.hierarchyUniqueName()&&l.depth()===member.depth()+1},$.ig.Level.prototype.getType());if(!level){return}levelName=level.uniqueName();levelSortDirections=this._tableView.appliedLevelSortDirections();for(i=0;i<levelSortDirections.length;i++){if(levelSortDirections[i].levelUniqueName===levelName){levelSortDirection=levelSortDirections[i];break}}if(levelSortDirection){levelSortDirection.sortDirection=levelSortDirection.sortDirection==="ascending"?"descending":"ascending"}else{levelSortDirection={levelUniqueName:levelName,sortBehavior:this.options.defaultLevelSortBehavior,sortDirection:this.options.firstLevelSortDirection};levelSortDirections.push(levelSortDirection)}noCancel=this._triggerHeadersSorting(evt,levelSortDirections);if(noCancel){hierarchyName=level.hierarchyUniqueName();if($.grep(this._ds.rowAxis(),function(h){return h.uniqueName()===hierarchyName}).length>0){this._tableView.columnSortDirections([])}this._tableView.levelSortDirections(levelSortDirections);this._tableView.initialize();options=this._configureOptions(this._ds);this._renderGrid(options);this._triggerHeadersSorted(evt,levelSortDirections,this._tableView.appliedLevelSortDirections())}},expandTupleMember:function(tupleLocation,tupleIndex,memberIndex,shouldUpdate){var dataSource=this._ds,hasColumns,hasRows,axisName;hasColumns=dataSource.columnAxis().length>0;hasRows=dataSource.rowAxis().length>0;if(this._ds.isModified()){return false}if(tupleLocation==="columnAxis"&&hasColumns){if(hasColumns){axisName="Axis0"}}else if(tupleLocation==="rowAxis"&&hasRows){if(hasColumns){axisName="Axis1"}else{axisName="Axis0"}}if(!axisName){throw new Error($.ig.PivotGrid.locale.noSuchAxis)}this._ds.expandTupleMember(axisName,tupleIndex,memberIndex);if(shouldUpdate){this._updateGrid(null,true)}},collapseTupleMember:function(tupleLocation,tupleIndex,memberIndex,shouldUpdate){var dataSource=this._ds,hasColumns,hasRows,axisName;hasColumns=dataSource.columnAxis().length>0;hasRows=dataSource.rowAxis().length>0;if(this._ds.isModified()){return false}if(tupleLocation==="columnAxis"&&hasColumns){if(hasColumns){axisName="Axis0"}}else if(tupleLocation==="rowAxis"&&hasRows){if(hasColumns){axisName="Axis1"}else{axisName="Axis0"}}if(!axisName){throw new Error($.ig.PivotGrid.locale.noSuchAxis)}this._ds.collapseTupleMember(axisName,tupleIndex,memberIndex);if(shouldUpdate){this._updateGrid()}},appliedColumnSortDirections:function(){return this._tableView?this._tableView.appliedColumnSortDirections():[]},appliedLevelSortDirections:function(){return this._tableView?this._tableView.appliedLevelSortDirections():[]},destroy:function(){var grid=this.grid();if(grid){grid.destroy()}$("#"+this.element.attr("id")+"_container_block").remove();this.element.removeClass(this.css.pivotGrid);$(this._ds).unbind("initialized.pivotgrid"+this.timestamp);$(this._ds).unbind("updated.pivotgrid"+this.timestamp);$.Widget.prototype.destroy.call(this)},_triggerPivotGridHeadersRendered:function(evt,ui){var args={owner:this,grid:ui.owner,table:ui.table};this._trigger("pivotGridHeadersRendered",evt,args)},_triggerPivotGridRendered:function(evt,ui){var args={owner:this,grid:ui.owner};this._trigger("pivotGridRendered",evt,args)},_triggerTupleMemberExpanding:function(evt,axisName,memberIndex,tupleIndex){var args={owner:this,dataSource:this._ds,axisName:axisName,memberIndex:memberIndex,tupleIndex:tupleIndex};return this._trigger("tupleMemberExpanding",evt,args)},_triggerTupleMemberExpanded:function(evt,axisName,memberIndex,tupleIndex){var args={owner:this,dataSource:this._ds,axisName:axisName,memberIndex:memberIndex,tupleIndex:tupleIndex};this._trigger("tupleMemberExpanded",evt,args)
},_triggerTupleMemberCollapsing:function(evt,axisName,memberIndex,tupleIndex){var args={owner:this,dataSource:this._ds,axisName:axisName,memberIndex:memberIndex,tupleIndex:tupleIndex};return this._trigger("tupleMemberCollapsing",evt,args)},_triggerTupleMemberCollapsed:function(evt,axisName,memberIndex,tupleIndex){var args={owner:this,dataSource:this._ds,axisName:axisName,memberIndex:memberIndex,tupleIndex:tupleIndex};this._trigger("tupleMemberCollapsed",evt,args)},_triggerSorting:function(evt,columnSortDirections){var args={owner:this,sortDirections:columnSortDirections};return this._trigger("sorting",evt,args)},_triggerSorted:function(evt,columnSortDirections,appliedColumnSortDirections){var args={owner:this,sortDirections:columnSortDirections,appliedSortDirections:appliedColumnSortDirections};this._trigger("sorted",evt,args)},_triggerHeadersSorting:function(evt,levelSortDirections){var args={owner:this,levelSortDirections:levelSortDirections};return this._trigger("headersSorting",evt,args)},_triggerHeadersSorted:function(evt,levelSortDirections,appliedLevelSortDirections){var args={owner:this,levelSortDirections:levelSortDirections,appliedLevelSortDirections:appliedLevelSortDirections};this._trigger("headersSorted",evt,args)}});$.extend(true,$.ui.igPivotGrid.prototype,$.ig.Pivot._pivotShared);$.extend($.ui.igPivotGrid,{version:"15.2.20152.1027"})})(jQuery);