/*!@license
 * Infragistics.Web.ClientUI Grid Sorting 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.grid.shared.js
 *	infragistics.ui.grid.featurechooser.js
 *	infragistics.ui.editors.js
 *	infragistics.ui.shared.js
 *	infragistics.dataSource.js
 *	infragistics.templating.js
 *	infragistics.util.js
 */
(function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.ui.grid.featurechooser","./infragistics.ui.editors"],factory)}else{return factory(jQuery)}})(function($){"use strict";$.widget("ui.igGridFiltering",$.ui.igWidget,{renderInFeatureChooser:true,options:{caseSensitive:false,filterSummaryAlwaysVisible:true,renderFC:true,filterSummaryTemplate:undefined,filterDropDownAnimations:"linear",filterDropDownAnimationDuration:500,filterDropDownWidth:0,filterDropDownHeight:0,filterExprUrlKey:null,filterDropDownItemIcons:true,columnSettings:[{columnKey:null,editorType:null,editorProvider:null,editorOptions:null,columnIndex:null,allowFiltering:true,condition:null,conditionList:[],defaultExpressions:[],customConditions:null}],type:null,filterDelay:500,mode:null,advancedModeEditorsVisible:false,advancedModeHeaderButtonLocation:"left",filterDialogWidth:500,filterDialogHeight:340,filterDialogFilterDropDownDefaultWidth:150,filterDialogExprInputDefaultWidth:100,filterDialogColumnDropDownDefaultWidth:null,renderFilterButton:true,filterButtonLocation:"left",nullTexts:{startsWith:undefined,endsWith:undefined,contains:undefined,doesNotContain:undefined,equals:undefined,doesNotEqual:undefined,greaterThan:undefined,lessThan:undefined,greaterThanOrEqualTo:undefined,lessThanOrEqualTo:undefined,on:undefined,notOn:undefined,after:undefined,before:undefined,thisMonth:undefined,lastMonth:undefined,nextMonth:undefined,thisYear:undefined,lastYear:undefined,nextYear:undefined,empty:undefined,notEmpty:undefined,"null":undefined,notNull:undefined},labels:{noFilter:undefined,clear:undefined,startsWith:undefined,endsWith:undefined,contains:undefined,doesNotContain:undefined,equals:undefined,doesNotEqual:undefined,greaterThan:undefined,lessThan:undefined,greaterThanOrEqualTo:undefined,lessThanOrEqualTo:undefined,trueLabel:undefined,falseLabel:undefined,after:undefined,before:undefined,today:undefined,yesterday:undefined,thisMonth:undefined,lastMonth:undefined,nextMonth:undefined,thisYear:undefined,lastYear:undefined,nextYear:undefined,on:undefined,notOn:undefined,advancedButtonLabel:undefined,filterDialogCaptionLabel:undefined,filterDialogConditionLabel1:undefined,filterDialogConditionLabel2:undefined,filterDialogOkLabel:undefined,filterDialogCancelLabel:undefined,filterDialogAnyLabel:undefined,filterDialogAllLabel:undefined,filterDialogAddLabel:undefined,filterDialogErrorLabel:undefined,filterSummaryTitleLabel:undefined,filterDialogClearAllLabel:undefined,empty:undefined,notEmpty:undefined,nullLabel:undefined,notNull:undefined,"true":undefined,"false":undefined},tooltipTemplate:undefined,featureChooserText:undefined,featureChooserTextHide:undefined,featureChooserTextAdvancedFilter:undefined,locale:{startsWithNullText:undefined,endsWithNullText:undefined,containsNullText:undefined,doesNotContainNullText:undefined,equalsNullText:undefined,doesNotEqualNullText:undefined,greaterThanNullText:undefined,lessThanNullText:undefined,greaterThanOrEqualToNullText:undefined,lessThanOrEqualToNullText:undefined,onNullText:undefined,notOnNullText:undefined,afterNullText:undefined,beforeNullText:undefined,emptyNullText:undefined,notEmptyNullText:undefined,nullNullText:undefined,notNullNullText:undefined,startsWithLabel:undefined,endsWithLabel:undefined,containsLabel:undefined,doesNotContainLabel:undefined,equalsLabel:undefined,doesNotEqualLabel:undefined,greaterThanLabel:undefined,lessThanLabel:undefined,greaterThanOrEqualToLabel:undefined,lessThanOrEqualToLabel:undefined,trueLabel:undefined,falseLabel:undefined,afterLabel:undefined,beforeLabel:undefined,todayLabel:undefined,yesterdayLabel:undefined,thisMonthLabel:undefined,lastMonthLabel:undefined,nextMonthLabel:undefined,thisYearLabel:undefined,lastYearLabel:undefined,nextYearLabel:undefined,atLabel:undefined,notAtLabel:undefined,atBeforeLabel:undefined,atAfterLabel:undefined,clearLabel:undefined,noFilterLabel:undefined,onLabel:undefined,notOnLabel:undefined,advancedButtonLabel:undefined,filterDialogCaptionLabel:undefined,filterDialogConditionLabel1:undefined,filterDialogConditionLabel2:undefined,filterDialogConditionDropDownLabel:undefined,filterDialogOkLabel:undefined,filterDialogCancelLabel:undefined,filterDialogAnyLabel:undefined,filterDialogAllLabel:undefined,filterDialogAddLabel:undefined,filterDialogErrorLabel:undefined,filterDialogCloseLabel:undefined,filterSummaryTitleLabel:undefined,filterSummaryTemplate:undefined,filterDialogClearAllLabel:undefined,tooltipTemplate:undefined,featureChooserText:undefined,featureChooserTextHide:undefined,featureChooserTextAdvancedFilter:undefined},filterDialogAddConditionTemplate:null,filterDialogAddConditionDropDownTemplate:null,filterDialogFilterTemplate:null,filterDialogFilterConditionTemplate:null,filterDialogAddButtonWidth:100,filterDialogOkCancelButtonWidth:120,filterDialogMaxFilterCount:5,filterDialogContainment:"owner",showEmptyConditions:false,showNullConditions:false,dialogWidget:"igGridModalDialog",persist:true,inherit:false},css:{filterRow:"ui-iggrid-filterrow ui-widget",filterCell:"ui-iggrid-filtercell",filterCellEditor:"ui-iggrid-filtereditor",filterDropDownList:"ui-menu ui-widget ui-widget-content ui-iggrid-filterddlist ui-corner-all",filterDropDown:"ui-iggrid-filterdd",filterDropDownListItemTextContainer:"ui-iggrid-filterddlistitemcontainer",filterDropDownListItem:"ui-iggrid-filterddlistitem",filterDropDownListItemAdvanced:"ui-iggrid-filterddlistitemadvanced",filterDropDownListItemWithIcons:"ui-iggrid-filterddlistitemicons ui-state-default",filterDropDownListItemClear:"ui-iggrid-filterddlistitemclear",filterDropDownListItemHover:"ui-iggrid-filterddlistitemhover ui-state-hover",filterDropDownListItemActive:"ui-iggrid-filterddlistitemactive ui-state-active",filterDateCell:"",filterTextCell:"",filterNumberCell:"",filterBoolCell:"",filterButton:"ui-iggrid-filterbutton ui-corner-all ui-icon ui-icon-triangle-1-s",filterButtonAdvanced:"ui-iggrid-filterbutton ui-iggrid-filterbuttonadvanced ui-icon ui-icon-search",filterButtonAdvancedRight:"ui-iggrid-filterbuttonright ui-iggrid-filterbuttonadvanced ui-icon ui-icon-search",filterButtonSimpleRight:"ui-iggrid-filterbuttonright",filterButtonHover:"ui-iggrid-filterbuttonhover ui-state-hover",filterButtonActive:"ui-iggrid-filterbuttonactive ui-state-active",filterButtonFocus:"ui-iggrid-filterbuttonfocus ui-state-focus",filterButtonDisabled:"ui-iggrid-filterbuttondisabled ui-state-disabled",filterButtonDate:"ui-iggrid-filterbuttondate",filterButtonString:"ui-iggrid-filterbuttonstring",filterButtonNumber:"ui-iggrid-filterbuttonnumber",filterButtonBoolean:"ui-iggrid-filterbuttonbool",filterButtonAdvancedHover:"ui-iggrid-filterbuttonadvancedhover ui-state-hover",filterButtonAdvancedActive:"ui-iggrid-filterbuttonadvancedactive ui-state-active",filterButtonAdvancedFocus:"ui-iggrid-filterbuttonadvancedfocus ui-state-focus",filterButtonAdvancedDisabled:"ui-iggrid-filterbuttonadvanceddisabled ui-state-disabled",filterItemIcon:"ui-iggrid-filtericon",filterItemIconContainer:"ui-iggrid-filtericoncontainer",filterItemIconStartsWith:"ui-iggrid-filtericonstartswith",filterItemIconEndsWith:"ui-iggrid-filtericonendswith",filterItemIconContains:"ui-iggrid-filtericoncontains",filterItemIconEquals:"ui-iggrid-filtericonequals",filterItemIconDoesNotEqual:"ui-iggrid-filtericondoesnotequal",filterItemIconDoesNotContain:"ui-iggrid-filtericondoesnotcontain",filterItemIconGreaterThan:"ui-iggrid-filtericongreaterthan",filterItemIconLessThan:"ui-iggrid-filtericonlessthan",filterItemIconGreaterThanOrEqualTo:"ui-iggrid-filtericongreaterthanorequalto",filterItemIconLessThanOrEqualTo:"ui-iggrid-filtericonlessthanorequalto",filterItemIconTrue:"ui-iggrid-filtericontrue",filterItemIconFalse:"ui-iggrid-filtericonfalse",filterItemIconAfter:"ui-iggrid-filtericonafter",filterItemIconBefore:"ui-iggrid-filtericonbefore",filterItemIconToday:"ui-iggrid-filtericontoday",filterItemIconYesterday:"ui-iggrid-filtericonyesterday",filterItemIconThisMonth:"ui-iggrid-filtericonthismonth",filterItemIconLastMonth:"ui-iggrid-filtericonlastmonth",filterItemIconNextMonth:"ui-iggrid-filtericonnextmonth",filterItemIconThisYear:"ui-iggrid-filtericonthisyear",filterItemIconLastYear:"ui-iggrid-filtericonlastyear",filterItemIconNextYear:"ui-iggrid-filtericonnextyear",filterItemIconOn:"ui-iggrid-filtericonon",filterItemIconNotOn:"ui-iggrid-filtericonnoton",filterItemIconClear:"ui-iggrid-filtericonclear",blockArea:"ui-widget-overlay ui-iggrid-blockarea",filterDialog:"ui-dialog ui-draggable ui-resizable ui-iggrid-dialog ui-widget ui-widget-content ui-corner-all",filterDialogHeaderCaption:"ui-dialog-titlebar ui-iggrid-filterdialogcaption ui-widget-header ui-corner-all ui-helper-reset ui-helper-clearfix",filterDialogHeaderCaptionTitle:"ui-dialog-title",filterDialogAddCondition:"ui-iggrid-filterdialogaddcondition",filterDialogAddConditionDropDown:"ui-iggrid-filterdialogaddconditionlist",filterDialogAddButton:"ui-iggrid-filterdialogaddbuttoncontainer ui-helper-reset",filterDialogOkCancelButton:"ui-dialog-buttonpane ui-widget-content ui-helper-clearfix ui-iggrid-filterdialogokcancelbuttoncontainer",filterDialogFiltersTable:"ui-iggrid-filtertable ui-helper-reset",filterDialogFilterRemoveButton:"ui-icon ui-icon-closethick",filterDialogClearAllButton:"ui-iggrid-filterdialogclearall",featureChooserModalDialogIcon:"ui-icon ui-iggrid-icon-advanced-filter",customEditorInputContainerDiv:"ui-igeditor-input-container ui-corner-all",customEditorParentDiv:"ui-igedit ui-igedit-container ui-widget ui-corner-all ui-state-default"},events:{dataFiltering:"dataFiltering",dataFiltered:"dataFiltered",dropDownOpening:"dropDownOpening",dropDownOpened:"dropDownOpened",dropDownClosing:"dropDownClosing",dropDownClosed:"dropDownClosed",filterDialogOpening:"filterDialogOpening",filterDialogOpened:"filterDialogOpened",filterDialogMoving:"filterDialogMoving",filterDialogFilterAdding:"filterDialogFilterAdding",filterDialogFilterAdded:"filterDialogFilterAdded",filterDialogClosing:"filterDialogClosing",filterDialogClosed:"filterDialogClosed",filterDialogContentsRendering:"filterDialogContentsRendering",filterDialogContentsRendered:"filterDialogContentsRendered",filterDialogFiltering:"filterDialogFiltering"},_createWidget:function(){this.options.columnSettings=[];$.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){this._editorProviders=[];this._filteringRequestCount=0;if(!$.fn.fadeToggle){$.fn.fadeToggle=$.fn.toggle}this._fcData={};this._isInitFC=false;this._dsTransformedCustomConditions=null;if(this.options.filterDropDownAnimations==="none"){this.options.filterDropDownAnimationDuration=1;this.options.filterDropDownAnimations="linear"}},changeGlobalLanguage:function(){},changeGlobalRegional:function(){},_getLabelTextByCondition:function(condition){return this._getLocaleValue(condition+"Label")},_getNullTextByCondition:function(condition){var nullText=this._getLocaleValue(condition+"NullText");return nullText===""?this._getLabelTextByCondition(condition):nullText},_changeLocaleForFeatureChooser:function(){var fc=this.grid.element.data("igGridFeatureChooser");if(fc&&this.renderInFeatureChooser){fc._removeFeature("Filtering");fc._removeFeature("AdvancedFiltering")}this._initFC()},_changeLocaleForFilterDialog:function(){var $filterDialog=this._getFilterDialog(),rows,$row,condEditor,exprEditorProvider,self=this;$.ui.igWidget.prototype.changeLocale.call(this,$filterDialog);$filterDialog[this.options.dialogWidget]("option",{locale:{modalDialogCaptionText:this._getLocaleValue("filterDialogCaptionLabel"),buttonApplyText:this._getLocaleValue("filterDialogOkLabel"),buttonCancelText:this._getLocaleValue("filterDialogCancelLabel")}});$filterDialog.find("[data-af-clear-all-button]").igButton("option","labelText",this._getLocaleValue("filterDialogClearAllLabel"));rows=$filterDialog.find("[data-af-row]");rows.each(function(){$row=$(this);condEditor=self._getDialogColSelByRow($row);exprEditorProvider=self._getDialogExprSelByRow($row).data("provider");condEditor.data("igTextEditor").option("language",self.grid.options.language);self._setEditorOption(exprEditorProvider.getEditor(),"language",self.grid.options.language)})},changeLocale:function(){var self=this,$container=this.grid._rootContainer(),$summaryContainer=$container.find("[data-filter-summary-template]"),$filterDialog=this._getFilterDialog(),i;this._setNullTextsInFilteringEditors();this._changeLocaleForFeatureChooser();$container.find("[data-filter-dropdown]").each(function(){self._super($(this))});this._updateTooltips(this.grid.dataSource.settings.filtering.expressions);if($filterDialog.length){this._changeLocaleForFilterDialog()}if(this._editorProviders&&this._editorProviders.length>0){for(i=0;i<this._editorProviders.length;i++){if(!this._hasEditor(this._editorProviders[i])){continue}this._setEditorOption(this._editorProviders[i].getEditor(),"language",this.grid.options.language)}}if($summaryContainer.length){this._changeLocaleForElement($summaryContainer);$summaryContainer.text(this._getLocaleValue("filterSummaryTemplate").replace("${matches}",$summaryContainer.attr("data-filter-summary-template")))}},changeRegional:function(){var regional=this.grid.options.regional,colKey,i;if(this._editorProviders&&this._editorProviders.length>0){for(i=0;i<this._editorProviders.length;i++){if(!this._hasEditor(this._editorProviders[i])){continue}colKey=this._editorProviders[i].getEditor().element.data("colKey");if(!this.grid.columnByKey(colKey).regional){this._setEditorOption(this._editorProviders[i].getEditor(),"regional",regional)}}}},_registerWidget:$.noop,_unregisterWidget:$.noop,_setOption:function(key,value){this._super(key,value);if(key==="mode"||key==="renderFilterButton"||key==="filterButtonLocation"||key==="type"){throw new Error(this._getLocaleValue("optionChangeNotSupported").replace("{optionName}",key))}if(key==="filterDropDownWidth"){this.grid._rootContainer().find("div ul").parent().css("width",value)}else if(key==="filterDropDownHeight"){this.grid._rootContainer().find("div ul").parent().css("height",value)}else if(key==="filterDialogWidth"){this._getFilterDialog().css("width",value)}else if(key==="filterDialogHeight"){this._getFilterDialog().css("height",value)}else if(key==="columnSettings"){this._initDefaultSettings()}},_isBool:function(val){return val==="bool"||val==="boolean"?true:false},_setEditorOption:function(editor,optionName,optionValue){if(editor._setOption){editor._setOption(optionName,optionValue)}else{if(optionName==="width"){editor.element.width(optionValue)}else if(optionName==="readOnly"){editor.element.prop("readonly",optionValue)}}},destroy:function(){var fc,gridId=this.grid.id(),cols=this.grid.options.columns,i,rootContainer=this.grid._rootContainer(),block=rootContainer.find("#"+gridId+"_container_block"),dialog=rootContainer.find("#"+gridId+"_container_dialog");this._destroyAllEditors();this.grid.container().find(".ui-iggrid-filterrow, .ui-iggrid-filterdd").remove();if(this.element.closest(".ui-iggrid-root").length){rootContainer.find("#"+gridId+"filtering_dd").remove()}if(this.options&&this.options.advancedModeEditorsVisible===false&&this.options.mode==="advanced"&&this.options.renderFilterButton===true){for(i=0;i<cols.length;i++){rootContainer.find("#"+gridId+"_dd_"+cols[i].key+"_button").remove()}}block.remove();dialog.remove();rootContainer.unbind("keydown.focusChecker");this.grid.element.unbind("iggridheadercellrendered",this._headerCellRenderedHandler);this.grid.element.unbind("iggridheaderrendered",this._headerRenderedHandler);this.grid.element.unbind("iggridvirtualhorizontalscroll",this._virtualHorizontalScrollHandler);this.grid.element.unbind("iggridresizingcolumnresized",this._columnResizedHandler);this.grid.element.unbind("iggridheaderextracellsmodified",this._headerInitHandler);this.grid.element.unbind("iggriddatabound",this._dataBoundHandler);this.grid.element.unbind("iggrid_columnsmoved",this._columnsAlteredHandler);this.grid.element.unbind("iggriduidirty",this._onUIDirtyHandler);delete this._headerRenderedHandler;delete this._virtualHorizontalScrollHandler;delete this._columnResizedHandler;delete this._headerInitHandler;delete this._onUIDirtyHandler;delete this._columnsAlteredHandler;this._fcData=null;this.options=null;if(this._loadingIndicator){delete this._loadingIndicator}if(this._filterInternal){delete this._filterInternal}if(this._toggleFilterRowHandler){delete this._toggleFilterRowHandler}if(this._openFilterDialogFromFCHandler){delete this._openFilterDialogFromFCHandler}fc=this.grid.element.data("igGridFeatureChooser");if(fc&&this.renderInFeatureChooser){fc._removeFeature("Filtering");fc._removeFeature("AdvancedFiltering")}this._superApply(arguments);return this},_destroyAllEditors:function(){var key;for(key in this._editorProviders){if(this._editorProviders.hasOwnProperty(key)&&this._editorProviders[key].destroy){this._editorProviders[key].getEditor().element.remove()}}this._editorProviders=null},_initLoadingIndicator:function(){this._loadingIndicator=this.grid._rootContainer().length>0?this.grid._rootContainer().igLoading().data("igLoading"):this.grid.element.igLoading().data("igLoading").indicator()},_setNullTextsInFilteringEditors:function(){var i,condition,cs=this.options.columnSettings,editorProviders=this._editorProviders,cols=this.grid.options.columns;if(editorProviders){for(i=0;i<editorProviders.length;i++){if(cs[i]&&cs[i].allowFiltering!==false){if(editorProviders[i].getValue()===null){editorProviders[i].setValue(null)}condition=this._getNullTextByCondition(this._findColumnSetting(cs[i].columnKey).condition);if(condition===null||condition===undefined){condition=this._getNullTextByCondition(this._getDefaultCondition(this._getColType(cols[i].key)))}this._setEditorOption(editorProviders[i].getEditor(),"placeHolder",condition)}}}},_onUIDirty:function(e,args){if(this.options.persist&&this.options.type==="remote"){return}var i,cols=this.grid.options.columns;if(args.owner===this||args.owner.element[0].id!==this.element[0].id){return}this._filterDialogClearAll();this._setNullTextsInFilteringEditors();for(i=0;i<cols.length;i++){this.grid._rootContainer().find("#"+this.grid.id()+"filtering_dd").find("li").removeClass("ui-iggrid-filterddlistitemactive ui-state-active")}$(".ui-iggrid-filterbutton",this.grid._rootContainer()).parent().attr("title",this._getLocaleValue("tooltipTemplate").replace("${condition}",this._getLocaleValue("noFilterLabel")));this.grid.dataSource.settings.filtering.expressions=[]},getFilteringMatchesCount:function(){var o=this.options,ds=this.grid.dataSource,matches;if(o.type==="local"||o.type==="remote"&&ds.hasTotalRecordsCount()===false){if(ds._filter){matches=ds._filteredData.length}else{matches=ds._data.length}}else{matches=ds.totalRecordsCount()}return matches},_dataRendered:function(){var w,fCntnr,defExpr,expr,matches=0,grid=this.grid,summary=grid.container().find(".ui-iggrid-footer .ui-iggrid-results").eq(0),footer=summary.parent(),shouldInitHeights=false,isInitiallyFiltered=false,i,isFiltering=false,exprs,reInitHeights=false,paging=grid.element.data("igGridPaging");if(!this._loadingIndicator){this._initLoadingIndicator()}if(this._hiddenCells&&this._hiddenCells.length>0){for(i=0;i<this._hiddenCells.length;i++){this._hiddenCells[i].show()}this._hiddenCells=undefined}if(this._defaultExpressions&&this._defaultExpressions.length>0){defExpr=this._defaultExpressions;this._defaultExpressions=[];this._updateFiltersUI(defExpr,false);isInitiallyFiltered=true;this._filteringRequestCount++}if(this._shouldFireDataFiltered){exprs=this._getDataColumnFilteringExpressions(grid.dataSource.settings.filtering.expressions);this._shouldFireDataFiltered=false;this._trigger(this.events.dataFiltered,null,{columnKey:this._curColKey,columnIndex:this._curColIndex,owner:this,expressions:exprs})}if(!summary.is(":visible")){shouldInitHeights=true}if(this._filteringRequestCount>0){if(this.options.filterSummaryAlwaysVisible===true&&summary.length===0){footer=$("<div></div>").appendTo(grid.container()).addClass("ui-widget ui-helper-clearfix ui-corner-bottom ui-widget-header ui-iggrid-footer");if(grid.hasFixedColumns()){footer.css("clear","both");reInitHeights=$.ig.util.isChrome&&footer.height()>grid._rootContainer().height()}summary=$("<span></span>").appendTo(footer).addClass("ui-iggrid-results");if(isInitiallyFiltered&&paging){footer.attr("id",grid.element[0].id+"_pager").addClass("ui-iggrid-pager");summary.attr("id",grid.element[0].id+"_pager_label").addClass("ui-iggrid-pagerrecordslabel")}shouldInitHeights=true}matches=this.getFilteringMatchesCount();if(!summary.parent().is(":visible")){summary.parent().show();shouldInitHeights=true}summary.text(this._getLocaleValue("filterSummaryTemplate").replace("${matches}",matches)).attr({title:this._getLocaleValue("filterSummaryTitleLabel"),"data-filter-summary-template":matches,"data-localeid":"filterSummaryTitleLabel","data-localeattr":"title"});summary.show();isFiltering=true;this._filteringRequestCount--}else if(this._filteringRequestCount<=0){expr=grid.dataSource.settings.filtering.expressions||[];if(summary.data("hideflag")!==false&&expr.length===0&&!(paging&&paging._plabel())){isFiltering=true;summary.hide();if(summary.parent().children().length===1){summary.parent().hide()}}else{summary.data("hideflag",true)}shouldInitHeights=true}this._loadingIndicator.hide();if(shouldInitHeights){if(grid.hasFixedColumns()){fCntnr=grid.fixedContainer()[0];if(fCntnr){w=fCntnr.style.width;fCntnr.style.width=""}}grid._initializeHeights();if(w){fCntnr.style.width=w}if(reInitHeights){grid._initializeHeights()}if(isFiltering&&(grid.options.virtualization||grid.options.rowVirtualization)){grid._updateVirtualScrollContainer();grid._virtualDom=null;grid._renderVirtualRecords()}}this._setEditorsWidth()},_initFC:function(){var columnKey,i,fc=this.grid.element.data("igGridFeatureChooser"),o=this.options,cs=this.options.columnSettings,showAdvancedButton=o.mode==="advanced"&&o.advancedModeEditorsVisible===true,isAdvanced=o.mode!=="simple"&&o.advancedModeEditorsVisible===false;this._isInitFC=true;if(o.renderFC===false){return}if(fc&&this.renderInFeatureChooser){if(this._toggleFilterRowHandler===null||this._toggleFilterRowHandler===undefined){this._toggleFilterRowHandler=$.proxy(this.toggleFilterRowByFeatureChooser,this)}if(this._openFilterDialogFromFCHandler===null||this._openFilterDialogFromFCHandler===undefined){this._openFilterDialogFromFCHandler=$.proxy(this._openFilterDialogFromFC,this)}for(i=0;i<cs.length;i++){columnKey=cs[i].columnKey;if(columnKey&&cs[i].allowFiltering===true&&fc._shouldRenderInFeatureChooser(columnKey)===true){this._filterRowShown=true;this._fcData[columnKey]=true;if(isAdvanced||showAdvancedButton){fc._renderInFeatureChooser(columnKey,{name:"AdvancedFiltering",text:this._getLocaleValue("featureChooserTextAdvancedFilter"),iconClass:this.css.featureChooserModalDialogIcon,isSelected:true,method:this._openFilterDialogFromFCHandler,updateOnClickAll:true,groupName:"modaldialog",groupOrder:3,order:3})}if(!isAdvanced){fc._renderInFeatureChooser(columnKey,{name:"Filtering",text:this._getLocaleValue("featureChooserText"),textHide:this._getLocaleValue("featureChooserTextHide"),iconClass:this.css.featureChooserModalDialogIcon,isSelected:true,method:this._toggleFilterRowHandler,updateOnClickAll:true,groupName:"toggle",groupOrder:1,order:2,type:"toggle",state:"hide"})}}}}},_columnResized:function(){if(this._filterRowShown!==false){this._setEditorsWidth()}},_setEditorsWidth:function(){if(this.options.mode!=="simple"&&this.options.advancedModeEditorsVisible!==true){return}var cs=this.options.columnSettings,cols=this.grid._visibleColumns(),cells=this.grid.headersTable().find("thead tr[data-role=filterrow]").first().find("td").not("[data-skip=true]"),cellWidth,i,j,skipColumn,editorProvider;for(i=0;i<cols.length;i++){for(j=0;j<cs.length;j++){if(cs[j].columnKey===cols[i].key&&cs[j].allowFiltering===false){skipColumn=true;break}}if(skipColumn){skipColumn=false;continue}if(!$.ig.util.isOpera&&(this.grid.options.height&&this.grid.options.fixedHeaders===true||$.ig.util.isWebKit)){cellWidth=cells.eq(i).innerWidth()}else{cellWidth=cells.eq(i).width()}cellWidth-=cells.eq(i).data("buttonWidth");editorProvider=cells.eq(i).find("span[data-filter-editor]").first().data("provider");if(!editorProvider){editorProvider=this._editorProviders[i]}if(editorProvider.getEditor){this._setEditorOption(editorProvider.getEditor(),"width",cellWidth);this._setEditorInputWidth(editorProvider)}}},_setEditorInputWidth:function(editorProvider){if(!editorProvider.getEditor()._editorContainer){return}var editorWidth,editorInputElement,buttonWidth,padding=2,editorButtons=editorProvider.getEditor()._editorContainer.find("div.ui-igedit-button-common");if(editorButtons.length>0){editorInputElement=editorProvider.getEditor()._editorContainer.find("div.ui-igeditor-input-container").first();if(editorInputElement.length>0){editorWidth=editorProvider.getEditor()._editorContainer.width();buttonWidth=editorButtons.first().outerWidth();editorInputElement.width(editorWidth-editorButtons.length*buttonWidth-padding)}}},_headerRendered:function(sender){var thead,filterrow,i=0,cell,w,button,cols=this.grid.options.columns,thCell,id,j,cs=this.options.columnSettings,skipColumn=false,buttonCss,showAdvancedInHeader=false,indicatorContainer,cancelFunc,ci,buttonWidth,isSimpleMode=this.options.mode==="simple"||this.options.advancedModeEditorsVisible===true,isToCheck=this.grid._initialHiddenColumns&&this.grid._initialHiddenColumns.length>0,cond;if(sender.target.id!==this.grid.element[0].id){return}thead=this.grid.container().find("thead");if(this.options.mode==="simple"||this.options.advancedModeEditorsVisible===true){filterrow=$("<tr></tr>").appendTo(thead).addClass(this.css.filterRow).attr("data-role","filterrow");this.grid._headerInit(filterrow)}else{filterrow=thead.find("tr:first")}cancelFunc=function(e){e.preventDefault();e.stopPropagation()};if(isToCheck){this._hiddenCells=[]}ci=i+filterrow.find("[data-skip=true]").length;if(this.options.advancedModeEditorsVisible===true||this.options.mode!=="advanced"){this._renderDropDownElement(this.grid.id()+"_filtering_dd",cols[0].key)}for(i=0;i<cols.length;i++,ci++){var colSettings=this._findColumnSetting(cols[i].key);cond=colSettings.defaultExpressions?colSettings.defaultExpressions[0].cond:colSettings.condition;colSettings.condition=cond?cond:this._getDefaultCondition(this._getColType(cols[i].key));if(isSimpleMode===true){cell=$("<td></td>").appendTo(filterrow).addClass(this.css.filterCell);if(isToCheck&&this._hiddenCells.length<this.grid._initialHiddenColumns.length){for(j=this.grid._initialHiddenColumns.length-1;j>=0;j--){if(this.grid._initialHiddenColumns[j].key===cols[i].key){cell.hide();this._hiddenCells.push(cell);break}}}cell.attr("aria-describedBy",this.grid.id()+"_"+cols[i].key)}else{cell=this.grid.container().find("#"+this.grid.id()+"_"+cols[i].key);if(cell.children().first().is("a")){cell.children().first().css("display","inline");cell.css("cursor","pointer")}cell.data("colName",cols[i].key);cell.attr("aria-describedBy",this.grid.id()+"_"+cols[i].key)}if(this.grid._isMultiColumnGrid!==true||isSimpleMode===true){if(i===cols.length-1&&this.grid.options.height&&parseInt(this.grid.options.height,10)>0){cell.css("width",parseInt(cols[i].width,10)+this.grid._scrollbarWidth())}else{cell.css("width",cols[i].width)}}for(j=0;j<cs.length;j++){if(cs[j].columnKey===cols[i].key&&cs[j].allowFiltering===false){if(this.options.advancedModeEditorsVisible===true||this.options.mode!=="advanced"){this._editorProviders.push({})}skipColumn=true;break}}if(skipColumn){skipColumn=false;continue}thCell=thead.children().first().find("th:nth-child("+(ci+1)+")");if($.ig.util.isWebKit&&thCell.length>0){w=thCell[0].offsetWidth}else if(this.grid.options.height&&this.grid.options.fixedHeaders===true||$.ig.util.isWebKit){w=thCell.innerWidth()}else{w=thCell.width()}showAdvancedInHeader=this.options.advancedModeEditorsVisible===false&&this.options.mode==="advanced"&&this.options.renderFilterButton===true;if(this.options.renderFilterButton===true&&!showAdvancedInHeader||showAdvancedInHeader&&this._renderFCFor(cols[i].key)===false){id=this.grid.element.attr("id")+"_dd_"+cols[i].key;buttonCss=this.options.mode==="advanced"?this.css.filterButtonAdvanced:this.css.filterButton;if(showAdvancedInHeader&&this.options.advancedModeHeaderButtonLocation==="right"){buttonCss=this.css.filterButtonAdvancedRight;button=$("<span></span>").appendTo(cell).addClass(buttonCss).data("colIndex",i)}else{button=$("<span></span>").prependTo(cell).addClass(buttonCss).data("colIndex",i)}if(this.options.mode==="advanced"){if(!cell.hasClass(this.grid.css.headerCellFeatureEnabledClass)){cell.addClass(this.grid.css.headerCellFeatureEnabledClass)}}if(this.options.mode==="simple"||this.options.mode==="advanced"&&this.options.advancedModeEditorsVisible===true){button.wrap('<a id="'+id+'_button" data-col-key="'+cols[i].key+'" href="#" title="'+this._getLocaleValue("tooltipTemplate").replace("${condition}",this._getLocaleValue("noFilterLabel"))+'" ></a>')}else{button.wrap('<a id="'+id+'_button" data-col-key="'+cols[i].key+'" href="#" title="'+this._getLocaleValue("tooltipTemplate").replace("${condition}",this._getLocaleValue("noFilterLabel"))+'" style="display:inline;"></a>')}indicatorContainer=cell.find(".ui-iggrid-indicatorcontainer");if(indicatorContainer.length===0){indicatorContainer=$("<div></div>").appendTo(cell).addClass("ui-iggrid-indicatorcontainer")}indicatorContainer.append(button.parent());w=parseInt(w,10);if(this.grid.options.height===null&&$.ig.util.isFF){buttonWidth=button.outerWidth(true)}else{buttonWidth=button.outerWidth(false)}w-=buttonWidth;cell.data("buttonWidth",buttonWidth)}if(this.options.renderFilterButton===true){if(this.options.advancedModeEditorsVisible===true||this.options.mode!=="advanced"){button.parent().bind({mousedown:$.proxy(this._toggleDropDown,this),mouseup:cancelFunc,click:cancelFunc,blur:$.proxy(this._deactivateButton,this),keydown:$.proxy(this._toggleDropDownKeyboard,this),mouseover:$.proxy(this._hoverButton,this),mouseout:$.proxy(this._unhoverButton,this),focus:$.proxy(this._activateButton,this)});if($.ig.util.isIE){button.parent().bind({focusout:$.proxy(this._deactivateButton,this)})}}else if(this._renderFCFor(cols[i].key)===false){button.parent().bind({click:$.proxy(this._openFilterDialog,this),keydown:$.proxy(this._openFilterDialogFromKeyboard,this),focus:$.proxy(this._activateButton,this),blur:$.proxy(this._deactivateButton,this)})}}if(this.options.advancedModeEditorsVisible===true||this.options.mode!=="advanced"){this._createEditor(cell,w,i,cols[i])}}if(this._getFilterDialog().length>0){this._getFilterDialog().remove()}this._renderFilterDialog()},_renderFCFor:function(columnKey){return!(this._fcData===null||this._fcData===undefined||this.options.renderFC===false||this._fcData[columnKey]!==true)},_columnMap:function(){var o=this.options,i,elem,cs=o.columnSettings,csLength=cs.length,result=[];if(o.renderFC===false){return false}for(i=0;i<csLength;i++){elem={columnKey:cs[i].columnKey,enabled:true};if(cs[i].allowFiltering===false){elem.enabled=false}result.push(elem)}return result},_headerCellRendered:function(){if(this._isInitFC!==true){this._initFC()}},_dataBound:function(){var i,editorProvider,editor;for(i=0;i<this._editorProviders.length||0;i++){editorProvider=this._editorProviders[i];editor=editorProvider.getEditor?editorProvider.getEditor():null;if(editor&&editor.widgetName&&(editor.widgetName==="igDateEditor"||editor.widgetName==="igDatePicker"||editor.widgetName==="igTimePicker")&&$.contains(document.documentElement,editor.element)){this._setEditorOption(editor,"displayTimeOffset",this.grid._calcOffsetForCol(null,this.grid.getColumnByTD(editor.element.closest("td")).column))}}},_openFilterDialogFromFC:function(event,columnKey){this._openFilterDialog(event,columnKey)},toggleFilterRowByFeatureChooser:function(event){var fc,$filterRow,o=this.options,isShown=this._filterRowShown,$thead=this.grid._rootContainer().find("thead"),isAdvanced=!(o.mode==="simple"||o.advancedModeEditorsVisible===true);
if(isShown===null||isShown===undefined){this._filterRowShown=true;isShown=this._filterRowShown}if(isAdvanced===false||isAdvanced&&o.advancedModeEditorsVisible){$filterRow=$thead.find('tr[data-role="filterrow"]');if(isShown===true){$filterRow.hide();if(document.documentMode===7||$.ig.util.isIE7){$filterRow.children().hide()}isShown=false}else{$filterRow.show();if(document.documentMode===7||$.ig.util.isIE7){$filterRow.children().show()}this._setEditorsWidth();isShown=true}if(event===null||event===undefined){fc=this.grid.element.data("igGridFeatureChooser");if(fc){fc._toggleSelectedItems("Filtering")}}this._filterRowShown=isShown;this.grid._initializeHeights();if(this.grid.options.autofitLastColumn&&this.grid.options.height&&this.grid.hasVerticalScrollbar()!==this.grid._hasVerticalScrollbar){this.grid._adjustLastColumnWidth()}}},_getEditorVal:function(editorProvider){if(Object.keys(editorProvider).length===0){return null}var editor=editorProvider.getEditor();if(editor._focused&&editor.widgetName!=="igDatePicker"){var newValue=editor._editorInput.val();if(newValue===editor._maskWithPrompts){newValue=""}editor._processInternalValueChanging(newValue)}return editorProvider.getValue()},_createEditor:function(parent,w,colIndex,col){var $editor,colType,colKey,self=this,editorType,buttonType,colSetting,isReadOnly=false,cond,provider,editorOptions,editorContainer,placeHolderText,editorCallbacks={keyDown:$.noop,textChanged:$.noop};colType=col.dataType;colKey=col.key;if(colType==="object"){colType=this._getColType(colKey)}colSetting=this._findColumnSetting(colKey);cond=colSetting.condition;placeHolderText=this._getNullTextByCondition(cond);editorOptions=colSetting?colSetting.editorOptions||{}:{};editorType=colSetting?this._getEditorProviderType(colType,colSetting.editorType):null;provider=colSetting?colSetting.editorProvider:null;if(!provider){try{provider=$.ig.GetEditorProvider(this.grid,col,editorType)}catch(err){this._editorProviders.push({});return}$editor=$("<span />").attr("data-filter-editor",true);if(this.options.filterButtonLocation==="left"){$editor.appendTo(parent)}else{$editor.prependTo(parent)}}if(this._isBool(colType)){isReadOnly=true;placeHolderText=""}if(colSetting.defaultExpressions&&colSetting.defaultExpressions.length>0){$(colSetting.defaultExpressions).each(function(){if(colSetting.customConditions&&colSetting.customConditions.hasOwnProperty(this.cond)){cond=colKey+"_"+this.cond;placeHolderText=this.cond}else{cond=this.cond;placeHolderText=self._getNullTextByCondition(cond)}isReadOnly=!self.requiresFilteringExpression(cond)})}if(editorType==="datepicker"){buttonType="dropdown,clear"}else if(editorOptions.buttonType){buttonType=editorOptions.buttonType}else{buttonType=editorType==="timepicker"||colType==="time"?"spin,clear":"clear"}editorOptions=$.extend({},{width:w,language:this.grid.options.language,regional:col.regional||this.grid.options.regional,preventSubmitOnEnter:editorOptions.preventSubmitOnEnter||true,suppressNotifications:editorOptions.suppressNotifications||true,readOnly:isReadOnly,textAlign:editorOptions.textAlign||"left",buttonType:buttonType,displayTimeOffset:this.grid._calcOffsetForCol(null,col),revertIfNotValid:editorOptions.revertIfNotValid||false,placeHolder:placeHolderText,allowNullValue:editorOptions.allowNullValue||true,tabIndex:this.grid.options.tabIndex,rendered:function(e,args){var edtr=args.owner,$edtrCont,$indCont;if(edtr.editorContainer){$edtrCont=edtr.editorContainer()}else{$edtrCont=edtr.element}if($edtrCont){$indCont=parent.find(".ui-iggrid-indicatorcontainer");if(self.options.filterButtonLocation==="left"){$indCont.prependTo($edtrCont)}else{$indCont.appendTo($edtrCont)}}if(!self.options.renderFilterButton){args.owner.element.on({mousedown:function(e){if(edtr.options.readOnly){self._toggleDropDown(e)}},blur:$.proxy(self._closeDropDown,self),keydown:$.proxy(self._toggleDropDownKeyboard,self)})}}},editorOptions);if(colType==="date"||colType==="datetime"||colType==="time"){editorOptions=$.extend({},editorOptions,{enableUTCDates:this.options.type==="remote"?true:this.grid.options.enableUTCDates,displayTimeOffset:this.options.type==="remote"?0:this.grid._calcOffsetForCol(null,col),valueChanged:$.proxy(this._filter,this),revertIfNotValid:false});editorCallbacks=$.extend(editorCallbacks,{valueChanged:$.proxy(this._filter,this)});if(col.format){editorOptions.dateInputFormat=col.format}}else{editorCallbacks=$.extend(editorCallbacks,{textChanged:$.proxy(this._filter,this)})}if(this._isBool(colType)){editorOptions=$.extend({},editorOptions,{isLimitedToListValues:false,allowNullValue:true})}editorContainer=provider.createEditor(editorCallbacks,colKey,editorOptions,this.grid.options.tabIndex,col.format,$editor,this.options.type==="remote"?0:this.grid._calcOffsetForCol(null,col));if(!$editor){$editor=editorContainer;var $indCont=parent.find(".ui-iggrid-indicatorcontainer");var parentDiv=$("<div />").addClass(this.css.customEditorParentDiv);var wrapperDiv=$("<div />").addClass(this.css.customEditorInputContainerDiv);var wrapperSpan=$("<span />").attr("data-filter-editor",true);$editor.appendTo(wrapperSpan);wrapperSpan.appendTo(wrapperDiv);if(self.options.filterButtonLocation==="left"){wrapperDiv.appendTo(parentDiv);$indCont.prependTo(parentDiv)}else{wrapperDiv.prependTo(parentDiv);$indCont.appendTo(parentDiv)}parentDiv.appendTo(parent);provider.setSize(parentDiv.width(),parentDiv.height())}$editor.data("colIndex",colIndex).data("colKey",colKey).data("provider",provider);this._editorProviders.push(provider);if($editor.is("input")){$editor.addClass(this.css.filterCellEditor)}else{$editor.find("input").addClass(this.css.filterCellEditor)}},_fixedColumnsChanged:function(args){var i,start=args.start,$edtr,len=args.length,at=args.at;this.grid._rearrangeArray(this.options.columnSettings,start,len,at);this.grid._rearrangeArray(this._editorProviders,start,len,at);for(i=0;i<this._editorProviders.length;i++){if(!this._hasEditor(this._editorProviders[i])){continue}$edtr=$(this._editorProviders[i].getEditor().element);$edtr.data("colIndex",i);$edtr.closest("td").find("span.ui-iggrid-filterbutton").data("colIndex",i)}},_columnsAltered:function(event,args){var i,cs,start=args.start,len=args.len,idx=args.index;if(args.owner.id()!==this.grid.id()||!start&&!len&&!idx){return}for(i=0;i<this.options.columnSettings.length;i++){cs=this.options.columnSettings[i];if(this.grid._isColumnHidden(cs.columnKey)===true){start+=i<=start?1:0;len+=i>=start&&i<start+len?1:0;idx+=i<=idx?1:0}}this.grid._rearrangeArray(this.options.columnSettings,start,len,idx);this.grid._rearrangeArray(this._editorProviders,start,len,idx);for(i=0;i<this._editorProviders.length;i++){if(!this._hasEditor(this._editorProviders[i])){continue}$(this._editorProviders[i].getEditor().element).data("colIndex",i);$(this._editorProviders[i].getEditor().element).closest("td").find("span.ui-iggrid-filterbutton").data("colIndex",i)}},_findColumnSetting:function(key){var i;for(i=0;i<this.options.columnSettings.length;i++){if(this.options.columnSettings[i].columnKey===key){return this.options.columnSettings[i]}}},filter:function(expressions,updateUI,addedFromAdvanced){var i,cond;this._loadingIndicator.show();if(expressions===undefined||expressions===null||expressions.length===0){for(i=0;i<this.options.columnSettings.length;i++){cond=this.options.columnSettings[i].condition;if(!this.requiresFilteringExpression(cond)){this.options.columnSettings[i].condition=null}}}if(!addedFromAdvanced){this._filterDataSource(expressions,true);this._updateFiltersUI([],false)}else{this._filterDataSource(expressions)}if(updateUI===undefined||updateUI===true){this._updateFiltersUI(expressions===undefined?this._generateExpressions():expressions,addedFromAdvanced)}},_filter:function(ui,args){clearTimeout(this._timeoutId);this._ui=ui;this._args=args;if(parseInt(this.options.filterDelay,10)===0){this._filterInternal()}else{this._timeoutId=setTimeout($.proxy(this._filterInternal,this),this.options.filterDelay)}},_filterInternal:function(colIndex,colKey){var args=this._args,_colIndex,_colKey,noCancel,editorProvider,exprs;if(args!==undefined){_colIndex=$(args.owner.element).data("colIndex");_colKey=$(args.owner.element).data("colKey")}else{_colIndex=colIndex;_colKey=colKey}exprs=this._generateExpressions(true);noCancel=this._trigger(this.events.dataFiltering,null,{columnKey:_colKey,columnIndex:_colIndex,owner:this,newExpressions:exprs});if(noCancel){this._loadingIndicator.show();editorProvider=this._editorProviders?this._editorProviders[_colIndex]:null;if(editorProvider){editorProvider._addedFromAdvanced=false}this._curColKey=_colKey;this._curColIndex=_colIndex;this._filterDataSource(exprs,false,true)}},_filterDataSource:function(expressions,apiCall,updateUI){var exprs,i,j,expr,col,button,cols=this.grid.options.columns,found=false,defaultTooltip,noCancel;defaultTooltip=this._getLocaleValue("tooltipTemplate").replace("${condition}",this._getLocaleValue("noFilterLabel"));if(apiCall){if($.type(expressions)==="array"&&expressions.length){for(i=0;i<expressions.length;i++){expr=expressions[i];if(expr.dataType){continue}col=this.grid.columnByKey(expr.fieldName);if(col){if(col.dataType){expr.dataType=col.dataType}else{expr.dataType="string"}}}}}if(expressions!==undefined&&!updateUI){if(apiCall===true){this.grid.dataSource.settings.filtering.expressions=expressions;if(this.options.mode==="advanced"){this._filterDialogClearAll();for(i=0;i<expressions.length;i++){this._addFilterFromDialog(null,expressions[i])}}}else{this.grid.dataSource.settings.filtering.expressions=expressions}}else{if(expressions!==undefined&&updateUI){exprs=expressions}else{exprs=this._generateExpressions(true)}for(i=0;i<cols.length;i++){found=false;button=this.grid._rootContainer().find("#"+this.grid.element[0].id+"_dd_"+cols[i].key+"_button");for(j=0;j<exprs.length;j++){if(cols[i].key===exprs[j].fieldName){found=true;if((exprs[j].expr===undefined||exprs[j].expr===null||exprs[j].expr==="")&&this.requiresFilteringExpression(exprs[j].cond)){button.attr("title",defaultTooltip)}else{button.attr("title",this._getLocaleValue("tooltipTemplate").replace("${condition}",this._getLabelTextByCondition(exprs[j].cond)))}break}}if(!found){button.attr("title",defaultTooltip)}}this.grid.dataSource.settings.filtering.expressions=exprs}if(this.options.persist){this._saveFilteringExpressions()}if(this.grid._hasUnboundColumns){this.grid._rebindUnboundColumns=true}this.grid.element.trigger("iggriduisoftdirty",{owner:this});noCancel=this.grid._trigger(this.grid.events.dataBinding,null,{owner:this.grid,dataSource:this.grid.dataSource});if(noCancel){exprs=this.grid.dataSource.settings.filtering.expressions;if(this.options.type==="remote"){this.grid.dataSource.settings.paging.pageIndex=0;this.grid._shouldResetPaging=true}else if(this.grid.container().find(".ui-iggrid-footer .ui-iggrid-results").length>0){this.grid.container().find(".ui-iggrid-footer .ui-iggrid-results").data("overrideLabel",exprs.length)}this._filteringRequestCount++;this._preserveSorting();if(exprs.length===0){if(!apiCall){this._shouldFireDataFiltered=true}if(this.options.type==="remote"){this._filteringRequestCount=0;this.grid.dataSource.dataBind()}else{this.grid.dataSource.settings.filtering.type="local";this._filteringRequestCount=0;this.grid.dataSource.clearLocalFilter();this.grid._renderData()}}else{if(this.options.type==="remote"){if(!apiCall){this._shouldFireDataFiltered=true}this.grid.dataSource.dataBind()}else{this.grid.dataSource.settings.filtering.type="local";this.grid.dataSource.filter(exprs);this.grid._renderData();if(!apiCall){this._trigger(this.events.dataFiltered,null,{columnKey:this._curColKey,columnIndex:this._curColIndex,owner:this,expressions:exprs})}}}}},_filterDataSourceClear:function(colKey,colIndex){var i,exprs=this.grid.dataSource.settings.filtering.expressions,noCancel,noCancelFiltering,clearFiltering=false;for(i=0;i<exprs.length;i++){if(exprs[i].fieldName===colKey){clearFiltering=true;$.ig.removeFromArray(exprs,i);break}}if(!clearFiltering){return}this.grid.dataSource.settings.filtering.expressions=exprs;if(this.options.persist){this._saveFilteringExpressions()}if(!this._curColKey||colKey){this._curColKey=colKey;this._curColIndex=colIndex}noCancelFiltering=this._trigger(this.events.dataFiltering,null,{columnKey:this._curColKey,columnIndex:this._curColIndex,owner:this,newExpressions:exprs});if(noCancelFiltering){noCancel=this.grid._trigger(this.grid.events.dataBinding,null,{owner:this.grid,dataSource:this.grid.dataSource});if(noCancel){this.grid.dataSource.settings.paging.pageIndex=0;this._preserveSorting();this.grid._shouldResetPaging=true;this._loadingIndicator.show();if(this.options.type==="remote"){if(exprs.length>0){this._shouldFireDataFiltered=true;this._filteringRequestCount++}else{this._filteringRequestCount=0;this._shouldFireDataFiltered=true}this.grid.dataSource.dataBind()}else{this.grid.dataSource.settings.filtering.type="local";if(this.grid.container().find(".ui-iggrid-footer .ui-iggrid-results").length>0){this.grid.container().find(".ui-iggrid-footer .ui-iggrid-results").data("overrideLabel",exprs.length)}if(exprs.length>0){this._filteringRequestCount++;this.grid.dataSource.filter(exprs)}else{this._filteringRequestCount=0;this.grid.dataSource.clearLocalFilter()}this.grid._renderData();this._trigger(this.events.dataFiltered,null,{columnKey:this._curColKey,columnIndex:this._curColIndex,owner:this,expressions:exprs})}}}},_preserveSorting:function(){var hasGroupedCols=false,groupBy=this.grid.element.data("igGridGroupBy"),sortSettings=this.grid.dataSource.settings.sorting;if(groupBy&&groupBy.options&&groupBy.options.groupedColumns&&groupBy.options.groupedColumns.length>0){hasGroupedCols=true}if(sortSettings.expressions.length>0&&hasGroupedCols){sortSettings.defaultFields=sortSettings.expressions}},_getDataColumnFilteringExpressions:function(fe){if(!this.grid._hasUnboundColumns){return fe}var grid=this.grid,newFE;newFE=$.grep(fe,function(s){var col=grid.columnByKey(s.fieldName);return!col||col.unbound!==true});return newFE},_saveFilteringExpressions:function(){var fe=this._getDataColumnFilteringExpressions(this.grid.dataSource.settings.filtering.expressions);if(this.element.closest(".ui-iggrid-root").data("igGrid")){this.grid._savePersistenceData(fe,"filtering",this.grid.element[0].id)}this._filteringExpressions=fe},_preserveFiltering:function(){var fe=this._filteringExpressions||this.grid._getPersistenceData("filtering",this.grid.element[0].id);if(fe){if(this.grid._hasUnboundColumns){this._updateFiltersUI([],false)}this.grid.dataSource.settings.filtering.expressions=fe;this.grid.dataSource.settings.filtering.defaultFields=fe;this._defaultExpressions=fe}},_updateFiltersUI:function(expressions){var i,editorProvider,condName,$li,exprLen=expressions.length,clearButton;if(this._editorProviders){for(i=0;i<this._editorProviders.length;i++){if(this.options.columnSettings[i].allowFiltering!==false&&this._editorProviders[i].setValue){this._editorProviders[i].setValue(null)}}}if(this.options.showEmptyConditions&&!exprLen){for(i=0;i<this.options.columnSettings.length;i++){condName=this.options.columnSettings[i].condition;if(condName==="empty"||condName==="notEmpty"||condName==="null"||condName==="notNull"){$li=this.grid._rootContainer().find("#"+this.grid.element[0].id+"_filtering_dd").find("ul").children().first();if($li.length){this._selectDropDownItem({currentTarget:$li},null)}}}}this._updateFilterSelectionUI(expressions);for(i=0;i<exprLen;i++){condName=this._resolveConditionNameFromExpression(expressions[i]);editorProvider=this._editorProviders[this._columnIndexFromKey(expressions[i].fieldName)];if(editorProvider!==undefined&&editorProvider!==null&&editorProvider.getEditor){if(this.requiresFilteringExpression(condName)){editorProvider.setValue(expressions[i].expr)}else{this._editorValueForCondition(condName,editorProvider);if(editorProvider.renderFormat!=="checkbox"){clearButton=editorProvider.editor.clearButton();if(clearButton!==undefined&&clearButton.attr("id")&&clearButton.attr("id").indexOf("clearButton")!==-1){clearButton.hide()}}}editorProvider._addedFromAdvanced=true}}this._updateTooltips(expressions)},_updateFilterSelectionUI:function(expression){var j,condName,filterList,items;filterList=this.grid._rootContainer().find("#"+this.grid.element[0].id+"_filtering_dd").find("ul");items=filterList.children();condName=this._resolveConditionNameFromExpression(expression);for(j=0;j<items.length;j++){if($(items[j]).attr("data-cond")===condName||$(items[j]).attr("data-cond")===""&&condName===undefined){this._selectDropDownItem({currentTarget:items[j]},null,expression);break}}},_updateTooltips:function(expressions){var button,title,found,titleText,tempTooltipExpr,condName,conditionLabel,i,j,expressionFieldName,cols=this.grid.options.columns,colsLength=cols.length,isSimpleMode=this.options.mode==="simple"||this.options.advancedModeEditorsVisible===true;titleText=this._getLocaleValue("tooltipTemplate").replace("${condition}",this._getLocaleValue("noFilterLabel"));title="";for(i=0;i<expressions.length;i++){button=this.grid._rootContainer().find("#"+this.grid.element[0].id+"_dd_"+expressions[i].fieldName+"_button");if(!this.requiresFilteringExpression(expressions[i].cond)||expressions[i].expr===undefined||expressions[i].expr===null){tempTooltipExpr=""}else{tempTooltipExpr=expressions[i].expr;if(expressions[i].type==="date"||expressions[i].type==="time"){if($.type(tempTooltipExpr)==="number"){tempTooltipExpr=new Date(tempTooltipExpr)}if(expressions[i].type==="time"){tempTooltipExpr=tempTooltipExpr.toTimeString?tempTooltipExpr.toTimeString():tempTooltipExpr}else if(this.grid.options.enableUTCDates&&$.type(tempTooltipExpr)==="date"&&tempTooltipExpr.toUTCString){tempTooltipExpr=tempTooltipExpr.toUTCString()}}}expressionFieldName=expressions[i].fieldName;for(j=0;j<colsLength;j++){if(cols[j].key===expressionFieldName){expressionFieldName=cols[j].headerText;break}}condName=this._resolveConditionNameFromExpression(expressions[i]);conditionLabel=this._getLabelTextByCondition(condName);if(isSimpleMode){button.attr("title",this._getLocaleValue("tooltipTemplate").replace("${condition}",conditionLabel));continue}if(i===0){button.attr("title",expressionFieldName+" "+conditionLabel+" "+tempTooltipExpr+" ")}else{button.attr("title",title+expressions[i].logic+" "+expressionFieldName+" "+conditionLabel+" "+tempTooltipExpr+" ")}title=button.attr("title")}for(i=0;i<colsLength;i++){found=false;for(j=0;j<expressions.length;j++){if(expressions[j].fieldName===cols[i].key){found=true;break}}if(!found){this.grid._rootContainer().find("#"+this.grid.element[0].id+"_dd_"+cols[i].key+"_button").attr("title",titleText)}}},_resolveConditionNameFromExpression:function(expression){var expressionFieldName,custConds=this._dsTransformedCustomConditions;expressionFieldName=expression.fieldName;if(custConds&&custConds[expressionFieldName+"_"+expression.cond]){return expressionFieldName+"_"+expression.cond}else{return expression.cond}},_columnIndexFromKey:function(key){var i,cols=this.grid.options.columns;for(i=0;i<cols.length;i++){if(cols[i].key===key){return i}}},_generateExpressions:function(filterRowTrigger){var exprs=[],cols=this.grid.options.columns,expr,i,currentCondition,requiresEntry,isExprAdded,dt,isDateObject,defExpr,precise,format,preciseInd;for(i=0;i<cols.length;i++){if(this._editorProviders&&this._editorProviders[i]&&this._editorProviders[i]._addedFromAdvanced&&!filterRowTrigger){continue}if(this.options.columnSettings[i].allowFiltering!==true){defExpr=this.options.columnSettings[i].defaultExpressions;if(defExpr&&defExpr.length){expr=defExpr[0].expr;currentCondition=defExpr[0].cond}else{continue}}else{expr=this._getEditorVal(this._editorProviders[i]);currentCondition=this.options.columnSettings[i].condition}requiresEntry=this.requiresFilteringExpression(currentCondition);if(currentCondition===undefined||currentCondition===null||currentCondition===""){continue}if((expr===undefined||expr===null||expr==="")&&requiresEntry){continue}precise="";dt=cols[i].dataType;isDateObject=dt==="date"||dt==="time";if(isDateObject&&expr){if(this.options.type==="remote"&&this.options.filterExprUrlKey!==null&&this.options.filterExprUrlKey!==undefined){expr=Date.UTC(expr.getUTCFullYear(),expr.getUTCMonth(),expr.getUTCDate(),expr.getUTCHours(),expr.getUTCMinutes())}else{format=cols[i].format;if(format&&format.indexOf){preciseInd=format.toLowerCase().indexOf("h");if(preciseInd===-1){preciseInd=format.indexOf("m")}if(preciseInd===-1){preciseInd=format.indexOf("s")}if(preciseInd>-1){precise=format.substr(preciseInd)}}if($.type(expr)==="date"){expr=new Date(expr.valueOf());if(precise===""&&currentCondition==="after"){expr.setHours(23);expr.setMinutes(59);expr.setSeconds(59);expr.setMilliseconds(999)}}}}isExprAdded=false;if(!isDateObject||isDateObject&&expr!==null&&expr!==undefined&&currentCondition!=="empty"&&currentCondition!=="notEmpty"&&currentCondition!=="null"&&currentCondition!=="notNull"||isDateObject&&!this.requiresFilteringExpression(currentCondition)){if(expr!==""&&!this._isBool(dt)&&!this.options.filterExprUrlKey){isExprAdded=true;this._addExpressions(exprs,cols[i].key,currentCondition,expr)}else if(this._isBool(dt)&&expr!==""&&expr!==null||!this._isBool(dt)&&(this.options.filterExprUrlKey!==undefined&&this.options.filterExprUrlKey!==null||this.options.type==="local")){isExprAdded=true;this._addExpressions(exprs,cols[i].key,currentCondition,expr)}else if(this._isBool(dt)&&(expr===""||expr===null)&&(currentCondition==="null"||currentCondition==="notNull"||currentCondition==="empty"||currentCondition==="notEmpty")){isExprAdded=true;this._addExpressions(exprs,cols[i].key,currentCondition,expr)}if(isExprAdded){if(dt===undefined&&$.type(expr)==="string"){exprs[exprs.length-1].dataType="string"}if(cols[i].unbound){exprs[exprs.length-1].dataType=dt}if(precise){exprs[exprs.length-1].preciseDateFormat=precise}}}}return exprs},_addExpressions:function(expressionsList,fieldName,condition,expressionValue){if($.type(expressionValue)==="array"){var i;for(i=0;i<expressionValue.length;i++){expressionsList.push({fieldName:fieldName,cond:condition,expr:expressionValue[i],logic:"OR"})}}else{expressionsList.push({fieldName:fieldName,cond:condition,expr:expressionValue})}},_getDefaultCondition:function(type){var result="equals";if(type===undefined||type===null||type==="string"){result="contains"}else if(type==="number"){result="equals"}else if(type==="date"){result="on"}else if(type==="time"){result="at"}else if(this._isBool(type)){result="true"}else if(type==="object"){result=""}return result},_initDefaultSettings:function(){var settings=[],key,de,cs=this.options.columnSettings,i,j,k,l,cols=this.grid.options.columns,allowFiltering,defExpr,isToCheckUnboundColumns=this.grid._hasUnboundColumns===true&&this.options.type==="remote",conditionIsValid,conds,custConds;this._defaultExpressions=this.grid.dataSource.settings.filtering.expressions||[];if(cols&&cols.length>0){for(i=0;i<cols.length;i++){allowFiltering=true;if(isToCheckUnboundColumns&&this.grid.getUnboundColumnByKey(cols[i].key)!==null){allowFiltering=false}settings[i]={columnIndex:i,columnKey:cols[i].key,allowFiltering:allowFiltering}}}if(settings.length===0&&this.grid.options.autoGenerateColumns&&cs.length>0){for(i=0;i<cs.length;i++){if(!cs[i].columnKey){continue}conds=this._populateConditionsList(cs[i].columnKey,this._getColType(cs[i].columnKey));defExpr=cs[i].defaultExpressions;custConds=cs[i].customConditions;if(defExpr&&defExpr.length>0){for(k=0;k<defExpr.length;k++){conditionIsValid=false;for(l=0;l<conds.length;++l){for(key in custConds){if(custConds.hasOwnProperty(key)){if(conds[l].condition===cs[i].columnKey+"_"+defExpr[k].cond){conditionIsValid=true;break}}}if(conditionIsValid){break}if(conds[l].condition===defExpr[k].cond){conditionIsValid=true;break}}if(!conditionIsValid){throw new Error($.ig.util.stringFormat(this._getLocaleValue("defaultConditionContainsInvalidCondition"),cs[i].columnKey))}de={fieldName:cs[i].columnKey,expr:defExpr[k].expr,cond:defExpr[k].cond};if(defExpr[k].logic){de.logic=defExpr[k].logic}this._defaultExpressions.push(de)}}}}else{for(i=0;i<cs.length;i++){for(j=0;j<settings.length;j++){if(settings[j].columnKey===cs[i].columnKey||cs[i].columnKey===undefined&&settings[j].columnIndex===cs[i].columnIndex){cs[i].columnKey=settings[j].columnKey;break}}if(j===settings.length){continue}conds=this._populateConditionsList(cs[i].columnKey,this._getColType(cs[i].columnKey));for(key in cs[i]){if(cs[i].hasOwnProperty(key)){if(key!=="columnKey"&&key!=="columnIndex"){settings[j][key]=cs[i][key]}if(key==="defaultExpressions"&&cs[i][key]){defExpr=cs[i][key];custConds=cs[i].customConditions;for(k=0;k<defExpr.length;k++){conditionIsValid=false;for(l=0;l<conds.length;++l){for(key in custConds){if(custConds.hasOwnProperty(key)){if(conds[l].condition===cs[i].columnKey+"_"+defExpr[k].cond){conditionIsValid=true;break}}}if(conditionIsValid){break}if(conds[l].condition===defExpr[k].cond){conditionIsValid=true;break}}if(!conditionIsValid){throw new Error($.ig.util.stringFormat(this._getLocaleValue("defaultConditionContainsInvalidCondition"),cs[i].columnKey))}de={fieldName:cs[i].columnKey,expr:defExpr[k].expr,cond:defExpr[k].cond};if(defExpr[k].logic){de.logic=defExpr[k].logic}this._defaultExpressions.push(de)}}}}}}this.options.columnSettings=settings;this.grid.dataSource.settings.filtering.expressions=this._defaultExpressions;this.grid.dataSource.settings.filtering.defaultFields=this._defaultExpressions},_transformCustomConditionsForDataSource:function(){var i,cs=this.options.columnSettings,curCS,custConds,curCond,newCond,key,keyCond;for(i=0;i<cs.length;++i){curCS=cs[i];custConds=curCS.customConditions;if(custConds){this._dsTransformedCustomConditions=this._dsTransformedCustomConditions||{};for(key in custConds){if(custConds.hasOwnProperty(key)){curCond=custConds[key];keyCond=curCS.columnKey+"_"+key;newCond={requireExpr:!!curCond.requireExpr,filterFunc:curCond.filterFunc,expressionText:curCond.expressionText||key};if(!this._getLabelTextByCondition(keyCond)){this.options.locale=this.options.locale||{};this.options.locale[keyCond+"Label"]=curCond.labelText;this.options.locale[keyCond+"NullText"]=curCond.labelText}this._dsTransformedCustomConditions[keyCond]=newCond}}}}this.grid.dataSource.settings.filtering.customConditions=this._dsTransformedCustomConditions},_renderDropDown:function(type,id,colName){var ul,i,item,obj,conds,cs=this.options.columnSettings,self=this,liHtml="",dsExpr;if($("#"+this.grid.id()+"_filtering_dd").length){ul=$("#"+this.grid.id()+"_filtering_dd").find("ul")}else{ul=this._renderDropDownElement(id,colName)}conds=this._populateConditionsList(colName,this._getColType(colName));if(this.options.filterDropDownItemIcons!==true&&conds.length>0){liHtml+="<li tabindex='"+this.grid.options.tabIndex+"' class='"+this.css.filterDropDownListItem+" "+this.css.filterDropDownListItemClear+"'> <a  class='ui-corner-all'>"+this._getLocaleValue("clearLabel")+"</a> </li>";for(i=0;i<conds.length;++i){liHtml+="<li tabindex='"+this.grid.options.tabIndex+"' class='"+this.css.filterDropDownListItem+"' data-cond='"+(conds[i].condition===undefined?"":conds[i].condition)+"' >"+"<a  class='ui-corner-all'>"+conds[i].text+"</a> </li>"}ul.append(liHtml)}else if(this.options.filterDropDownItemIcons===true&&conds.length>0){obj={itemClass:this.css.filterDropDownListItemWithIcons,imgContainerClass:this.css.filterItemIconContainer,textClass:this.css.filterDropDownListItemTextContainer};this._renderDropDownToList(obj,[{text:this._getLocaleValue("clearLabel"),localeId:"clearLabel",imgClass:this.css.filterItemIconClear,itemClass:this.css.filterDropDownListItemClear}],ul);this._renderDropDownToList(obj,conds,ul)}ul.parent().bind({mousedown:function(){self._cancelNextBlur=true}});ul.children().bind({focus:function(evt){$(evt.target).parent().data("focussed",true)},blur:function(evt){$(evt.target).parent().data("focussed",false);setTimeout(function(){self._checkCloseDropDown(evt)},10)},keydown:$.proxy(this._changeSelectionKeyboard,this)});if(this.options.mode==="advanced"){this._renderAdvancedButton(ul)}for(i=0;i<this.grid.dataSource.settings.filtering.expressions.length;i++){if(this.grid.dataSource.settings.filtering.expressions[i].fieldName===colName){dsExpr=this.grid.dataSource.settings.filtering.expressions[i]}}for(i=0;i<cs.length;i++){if(cs[i].columnKey===colName){if(cs[i].condition==="null"){item=ul.find(':contains("'+this._getLabelTextByCondition("null")+'")')}else if(!this.requiresFilteringExpression(cs[i].condition)&&!dsExpr){continue}else{item=ul.find(':contains("'+this._getLabelTextByCondition(cs[i].condition)+'")')}item=item.children().first().closest("li");item.addClass(this.css.filterDropDownListItemActive).parent().data("selectedItem",$("li",item.parent()).index(item))}}if(dsExpr){this._updateFilterSelectionUI(dsExpr)}},_renderAdvancedButton:function(ul){var li;li=$("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItemAdvanced);this._currentButton=$(toStaticHTML('<input type="button"></input>'));this._currentButton.igButton({labelText:this._getLocaleValue("advancedButtonLabel")}).attr({"data-localeid":"advancedButtonLabel","data-localeattr":"value"}).bind({mousedown:$.proxy(this._openFilterDialog,this)});li.append(this._currentButton)},_openFilterDialogFromKeyboard:function(event){if(event.keyCode===$.ui.keyCode.ENTER){this._openFilterDialog(event)}},_checkModalDialogFocus:function(){var $dialog=this._getFilterDialog(),$container=this.grid._rootContainer();$container.unbind("keydown.focusChecker");$container.bind("keydown.focusChecker",function(e){var tabElems,target,gridContainer=$container[0];if(e.keyCode===$.ui.keyCode.TAB){target=document.activeElement;if(!target||!gridContainer){return}if(target===gridContainer||$.contains(gridContainer,target)&&!$.contains($dialog[0],target)){tabElems=$(":tabbable",$dialog);tabElems.first().focus();return}}})},_removeFilterDialog:function(){this._getFilterDialog().remove();this._filterDialog=null},_getFilterDialog:function(){this._filterDialog=this._filterDialog&&this._filterDialog.length?this._filterDialog:this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog");return this._filterDialog},_filterDialogOkClicked:function(event,ui){var noCancel=this._trigger(this.events.filterDialogFiltering,null,{dialog:this._getFilterDialog(),owner:this});if(noCancel){ui.toClose=true}},_openFilterDialog:function(event,columnKey){var $target=$(event.target),dialog=this._getFilterDialog();this._dialogCurrentColumn=$target.closest("ul").data("colName");if(this._dialogCurrentColumn===undefined||this._dialogCurrentColumn===null){if(columnKey!==null&&columnKey!==undefined){this._dialogCurrentColumn=columnKey}else{this._dialogCurrentColumn=$target.closest("th").data("colName")}}if(this._dialogCurrentColumn===undefined||this._dialogCurrentColumn===null){this._dialogCurrentColumn=$target.attr("data-col-key")}dialog[this.options.dialogWidget]("openModalDialog");event.preventDefault();event.stopPropagation()},_filterDialogOpening:function(event){var maxZ,left,top,pos,h,w,bh,dh,dw,bw,addDefault=true,noCancel=true,block=this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_block"),dialog=this._getFilterDialog(),rOffset,i,expressions=this.grid.dataSource.settings.filtering.expressions;this._checkModalDialogFocus();maxZ=$.ig.getMaxZIndex(this.grid.container().attr("id")+"_dialog");block.css("zIndex",maxZ+1);dialog.css("zIndex",maxZ+2);if(this.options.filterDialogContainment==="owner"){dialog.draggable("option","containment",this.grid._rootContainer())}else{dialog.draggable("option","containment","document")}dialog.find(".ui-iggrid-filtertable tbody tr").remove();this._dialogCurrentType=this.grid.columnByKey(this._dialogCurrentColumn).dataType;dialog.find(".ui-iggrd-filtertable tbody tr").remove();if(expressions&&expressions.length>0){addDefault=true;for(i=0;i<expressions.length;i++){if(!addDefault||expressions[i].fieldName===this._dialogCurrentColumn){
addDefault=false}this._addFilterFromDialog(null,expressions[i])}if(addDefault){this._addFilterFromDialog()}this._setFilteringConditions(expressions,dialog)}else{this._addFilterFromDialog()}noCancel=this._trigger(this.events.filterDialogOpening,null,{dialog:dialog,owner:this});if(noCancel){pos=$.ig.util.offset(this.grid._rootContainer());left=pos.left;top=pos.top;if(block.outerWidth()!==this.grid._rootContainer().outerWidth()){block.css("width",this.grid._rootContainer().outerWidth())}if(block.outerHeight()!==this.grid._rootContainer().outerHeight()){block.css("height",this.grid._rootContainer().outerHeight())}this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog_error").hide();rOffset=$.ig.util.getRelativeOffset(block);block.css({left:left-rOffset.left,top:top-rOffset.top}).fadeToggle();w=this.grid._rootContainer().outerWidth();h=this.grid._rootContainer().outerHeight();bw=$(window).width();bh=$(window).height();if(w+left>bw){w=w-(w+left-bw)}if(w<=0){w=this.grid._rootContainer().outerWidth()}if(h+top>bh){h=h-(h+top-bh)}if(h<=0){h=this.grid._rootContainer().outerHeight()}dh=parseInt(this.options.filterDialogHeight,10);dw=parseInt(this.options.filterDialogWidth,10);if(isNaN(dh)||dh<=0){dh=dialog.outerHeight()}if(isNaN(dw)||dw<=0){dw=dialog.outerWidth()}top=top+parseInt(h/2,10)-dh/2;left=left+parseInt(w/2,10)-dw/2;top=top<0?pos.top:top;left=left<0?pos.left:left;rOffset=$.ig.util.getRelativeOffset(dialog);dialog.focus();if(!(this.options.mode==="advanced"&&this.options.advancedModeEditorsVisible===false)&&this._currentTarget!==null&&this._currentTarget!==undefined){this._toggleDropDown({currentTarget:this._currentTarget},true)}}else{event.preventDefault();event.stopPropagation()}},_filterDialogOpened:function(){var dialog=this._getFilterDialog();this._trigger(this.events.filterDialogOpened,null,{dialog:dialog,owner:this})},_closeFilterDialog:function(event){var dialog=this._getFilterDialog();dialog[this.options.dialogWidget]("closeModalDialog",false,event);event.preventDefault();event.stopPropagation()},_setFilteringConditions:function(filtExpr,dialog){var boolLogicDropDown=dialog.find("div."+this.css.filterDialogAddConditionDropDown+" input:first");if(filtExpr.length>0){if(filtExpr[0].logic==="AND"){boolLogicDropDown.val(this._getLocaleValue("filterDialogAllLabel"))}else{boolLogicDropDown.val(this._getLocaleValue("filterDialogAnyLabel"))}}},_filterDialogClosing:function(evt,ui){var noCancel=this._trigger(this.events.filterDialogClosing,null,{owner:this});if(!noCancel){ui.toClose=false;evt.preventDefault();evt.stopPropagation()}else{ui.toClose=true}},_filterDialogClosed:function(evt,ui){this._trigger(this.events.filterDialogClosed,null,{owner:this});if(ui.accepted){this._searchFilterDialog()}},_getColumnCondByText:function(text,colKey){var conds=this._populateConditionsList(colKey,this._getColType(colKey));var cond=conds.filter(function(cond){return cond.text===text});return cond.length!==0?cond[0].condition:""},_searchFilterDialog:function(){var expressions=[],rows,boolLogic,filterLogic,i,type,exprObj,$row,selectedCol,expr,noCancelFiltering=true,cond,col,$input,hrs,mins,sec,ms,provider;rows=this._getFilterDialog().find("[data-af-row]");if(!rows.length){rows=this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog table tbody").children()}boolLogic="and";filterLogic=this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog input:first");if(filterLogic.length>0){boolLogic=this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog input:first")[0].value===this._getLocaleValue("filterDialogAllLabel")?"AND":"OR"}for(i=0;i<rows.length;i++){$row=$(rows[i]);$input=this._getDialogColSelByRow($row);selectedCol=$input.data("igTextEditor").getSelectedListItem().data("colKey");if(selectedCol!==undefined){col=this.grid.columnByKey(selectedCol)}if(!col){col=this.grid.columnByText($input[0].value)}if(!col){continue}type=col.dataType;provider=this._getDialogExprSelByRow($row).data("provider");expr=provider.getValue();expr=!expr&&type==="string"?"":expr;cond=this._getColumnCondByText(this._getDialogCondSelByRow($row)[0].value,col.key);if($.type(expr)==="date"){if(this.options.type==="local"&&(!col.format||col.format==="date")){if(cond==="after"){hrs=23;mins=59;sec=59;ms=999}else{hrs=0;mins=0;sec=0;ms=0}}if(provider.editor&&provider.editor.options.enableUTCDates){if(hrs===undefined){hrs=expr.getUTCHours();mins=expr.getUTCMinutes()}expr=Date.UTC(expr.getUTCFullYear(),expr.getUTCMonth(),expr.getUTCDate(),hrs,mins)}else if(hrs!==undefined){expr.setHours(hrs);expr.setMinutes(mins);expr.setSeconds(sec);expr.setMilliseconds(ms)}}exprObj={fieldName:col.key,cond:cond,expr:expr,logic:boolLogic,type:type};if(col.unbound&&type){exprObj.dataType=type}else if(type===undefined&&$.type(expr)==="string"){exprObj.dataType="string"}expressions.push(exprObj)}this._currentAdvancedExpressions=expressions;noCancelFiltering=this._trigger(this.events.dataFiltering,null,{owner:this,newExpressions:expressions});if(noCancelFiltering){this.filter(expressions,true,true)}},_filterDialogStartMove:function(){this._isFilterDialogMouseDown=true},_filterDialogStopMove:function(){this._isFilterDialogMouseDown=false;this._dialogClientX=undefined;this._dialogClientY=undefined},_filterDialogMove:function(e,ui){$(e.target).find(".ui-igedit-fieldincontainer").igTextEditor("hideDropDown");this._trigger(this.events.filterDialogMoving,null,{dialog:e.target,owner:this,originalPosition:ui.originalPosition,position:ui.position})},_renderFilterDialog:function(){var dialog,condObj,dropDownData,condElement,condDropDown,closeButton,f=this,opts=this.options,id=this.grid.container().attr("id"),captionsContainer,dialogContent,noCancel=true,addClearButtons,limit,container,containment,titleLabel=this._getLocaleValue("filterDialogCaptionLabel"),searchButtonLabel=this._getLocaleValue("filterDialogOkLabel"),cancelButtonLabel=this._getLocaleValue("filterDialogCancelLabel");container=this.grid._rootContainer();if(this.options.filterDialogContainment==="owner"){containment=this.grid._rootContainer()}else{containment="window"}dialog=$("<div></div>").appendTo(container).attr("id",id+"_dialog");dialog[this.options.dialogWidget]({containment:containment,locale:{modalDialogCaptionText:titleLabel,buttonApplyText:searchButtonLabel,buttonCancelText:cancelButtonLabel},modalDialogWidth:opts.filterDialogWidth,modalDialogHeight:opts.filterDialogHeight,gridContainer:this.grid._rootContainer(),modalDialogOpening:$.proxy(this._filterDialogOpening,this),modalDialogOpened:$.proxy(this._filterDialogOpened,this),modalDialogMoving:$.proxy(this._filterDialogMove,this),modalDialogClosing:$.proxy(this._filterDialogClosing,this),modalDialogClosed:$.proxy(this._filterDialogClosed,this),buttonOKClick:$.proxy(this._filterDialogOkClicked,this),tabIndex:this._getNextTabIndex()});captionsContainer=dialog[this.options.dialogWidget]("getCaptionButtonContainer");closeButton=$("<span></span>").appendTo($("<a></a>").appendTo(captionsContainer).attr({href:"#",role:"button","data-localeid":"filterDialogCloseLabel","data-localeattr":"title",title:this._getLocaleValue("filterDialogCloseLabel"),tabindex:this._getNextTabIndex()}).bind({click:$.proxy(this._closeFilterDialog,this)}).addClass("ui-dialog-titlebar-close ui-corner-all")).addClass("ui-icon ui-icon-closethick");noCancel=this._trigger(this.events.filterDialogContentsRendering,null,{dialogElement:dialog,owner:this});if(noCancel){dialogContent=dialog[this.options.dialogWidget]("getContent");condObj={label1:this._getLocaleValue("filterDialogConditionLabel1"),label2:this._getLocaleValue("filterDialogConditionLabel2")};dropDownData=[{text:this._getLocaleValue("filterDialogAllLabel"),dataLocale:"filterDialogAllLabel",value:"all"},{text:this._getLocaleValue("filterDialogAnyLabel"),dataLocale:"filterDialogAnyLabel",value:"any"}];if(this.options.filterDialogAddConditionTemplate&&typeof this.options.filterDialogAddConditionTemplate==="string"){condElement=$(this._fTmplWrappers[this.grid.id()+"_filterDialogAddConditionTemplate"](condObj))}else{condElement=$("<div><span data-localeid='filterDialogConditionLabel1'>"+condObj.label1+"</span><div><input tabindex='"+this._getNextTabIndex()+"' "+"data-localeattr='title' "+"data-localeid='filterDialogConditionDropDownLabel' "+" title='"+this._getLocaleValue("filterDialogConditionDropDownLabel")+"'/></div><span data-localeid='filterDialogConditionLabel2'>"+condObj.label2+"</span></div>")}condElement.appendTo(dialogContent).addClass(this.css.filterDialogAddCondition);if(this.options.filterDialogAddConditionDropDownTemplate&&typeof this.options.filterDialogAddConditionDropDownTemplate==="string"){condDropDown=$(this._fTmplWrappers[this.grid.id()+"_filterDialogAddConditionDropDownTemplate"](dropDownData));condDropDown.appendTo(condElement.find("div").addClass(this.css.filterDialogAddConditionDropDown).find("select"))}else{condElement.find("div").addClass(this.css.filterDialogAddConditionDropDown).find("input").igTextEditor({language:this.grid.options.language,preventSubmitOnEnter:true,listItems:[dropDownData[0].text,dropDownData[1].text],button:"dropdown",isLimitedToListValues:true,allowNullValue:false,buttonType:"dropdown",height:24,width:"80px",value:dropDownData[0].text,dropDownAttachedToBody:true})}addClearButtons=$("<div></div>").appendTo(dialogContent);$(toStaticHTML('<input type="button"></input>')).attr({tabindex:this._getNextTabIndex(),"data-af-add-button":true,"data-localeid":"filterDialogAddLabel","data-localeattr":"value"}).appendTo($("<span></span>").appendTo(addClearButtons).addClass(this.css.filterDialogAddButton)).igButton({labelText:this._getLocaleValue("filterDialogAddLabel"),width:this.options.filterDialogAddButtonWidth,tabindex:this._getNextTabIndex()}).bind({click:$.proxy(this._addFilterFromDialog,this)});$("<button type='button' />").attr({id:id+"_afd_clearall",tabindex:this._getNextTabIndex(),"data-af-clear-all-button":true}).appendTo(addClearButtons).css("float","right").igButton({labelText:this._getLocaleValue("filterDialogClearAllLabel"),click:$.proxy(this._filterDialogClearAll,this),css:{buttonClasses:this.css.filterDialogClearAllButton,buttonHoverClasses:"",buttonActiveClasses:"",buttonFocusClasses:"",buttonLabelClass:""}});$("<label></label>").appendTo(dialogContent).attr("id",dialog.attr("id")+"_error").hide().text(this._getLocaleValue("filterDialogErrorLabel")).addClass("ui-widget ui-state-error ui-igvalidator-label");$("<table><tbody></tbody></table>").appendTo(dialogContent).addClass(this.css.filterDialogFiltersTable).css("width","100%").css("border-collapse","collapse").css("border-spacing",0);if(this._hc===true){limit=this.grid._rootContainer().find("#"+this.grid.element[0].id.split("_")[0]+"_container")}else{limit=this.grid._rootContainer()}dialog.bind({keydown:function(e){var tabElems,first,last;if(e.keyCode===$.ui.keyCode.ESCAPE){f._closeFilterDialog(e)}if(e.keyCode!==$.ui.keyCode.TAB){return}tabElems=$(":tabbable",dialog);first=tabElems.first();last=tabElems.last();if(e.target===last[0]&&!e.shiftKey){first.focus();return false}if(e.target===first[0]&&e.shiftKey){last.focus();return false}},drag:function(){dialog.find("input[data-af-col]").igTextEditor("hideDropDown")}});dialog.find(".ui-dialog-content").bind({scroll:function(){dialog.find("input[data-af-col]").igTextEditor("hideDropDown")}});this._trigger(this.events.filterDialogContentsRendered,null,{dialogElement:dialog,owner:this})}},_setResizableEnv:function(){var initH,e=this._getFilterDialog(),rCont=e.find(">.ui-dialog-content"),hCont=e.find(">.ui-dialog-titlebar"),bCont=e.find(">.ui-dialog-buttonpane");if(!this._resizeCont){this._resizeCont=rCont;initH=e.height()-hCont.outerHeight()-(rCont.outerHeight()-rCont.height())-bCont.outerHeight();this._setFilterDialogContentHeight(initH)}this._resizeCont=rCont;if(e[0].style.height===""){e.css("height",e.height())}this._trigger(this.events.filterDialogOpened,null,{dialog:e,owner:this})},_resizeHandler:function(event,ui){var u=ui.originalElement,heightDifference,e=this._getFilterDialog(),rCont=e.find(">.ui-dialog-content"),hCont=e.find(">.ui-dialog-titlebar"),bCont=e.find(">.ui-dialog-buttonpane"),pad=rCont.outerHeight()-rCont.height();heightDifference=hCont.outerHeight(true)+bCont.outerHeight(true)+pad;this._setFilterDialogContentHeight(u.height()-heightDifference)},_setFilterDialogContentHeight:function(height){this._resizeCont.css({height:height+"px"})},_changeFilterCondition:function(e){var editor,condition,$target=$(e.target),$row=$target.closest("[data-af-row]");if(!$row.length){$row=$target.closest("tr")}condition=this._getColumnCondByText(e.target.value,this._dialogCurrentColumn);editor=this._getDialogExprSelByRow($row);this._setFilterDialogInput(editor,condition)},_setFilterDialogInput:function(editor,condition){var editorProvider=editor.data("provider"),requiresEntry=this.requiresFilteringExpression(condition);if(!editorProvider){return}this._setEditorOption(editorProvider.getEditor(),"readOnly",!requiresEntry);if(!requiresEntry){this._editorValueForCondition(condition,editorProvider)}},_getDialogColSelByRow:function($frow){var $elem=$frow.find("[data-af-col]");if(!$elem.length){$elem=$frow.find("td:first").find("input").first()}return $elem},_getDialogCondSelByRow:function($frow){var $elem=$frow.find("[data-af-cond]");if(!$elem.length){$elem=$frow.find("td:nth-child(2)").find("input").first()}return $elem},_getDialogExprSelByRow:function($frow){var $elem=$frow.find("[data-af-expr]");if(!$elem.length){$elem=$frow.find("td:nth-child(3)").find("input").first()}return $elem},_getDialogRmvBtnByRow:function($frow){var $elem=$frow.find("[data-af-rmv]");if(!$elem.length){$elem=$frow.find("td:last").find("span")}return $elem},_getNextTabIndex:function(){var gti=this.grid.options.tabIndex;return gti+1},_getIntialConditionForCol:function(colSettings,key){var colSetting=colSettings.filter(function(obj){return obj.columnKey===key})[0],cond=colSetting.condition,condList=this._populateConditionsList(key,this._getColType(key)).map(function(obj){return obj.condition});if(colSetting.customConditions&&colSetting.customConditions.hasOwnProperty(cond)){cond=key+"_"+cond}if(condList&&cond){if(condList.indexOf(cond)!==-1){return condList[condList.indexOf(cond)]}else{if(cond===this._getDefaultCondition(this._getColType(key))){return condList[0]}else{throw new Error($.ig.util.stringFormat(this._getLocaleValue("initialConditionIsNotInTheConditionsListArrayOrIsNotInTheDefaultConditions"),key))}}}return this._getDefaultCondition(this._getColType(key))},_addFilterFromDialog:function(e,expression){var tableBody=this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog table tbody"),cs=this.options.columnSettings,rows,filterObj={},filterRow,colKeys,colTexts,i,noCancel=true,field,type,cnd,defaultValue,condition,col,conds,shouldDisable=false,input,matchingConditions,owner=this,editorWidth=this.options.filterDialogFilterDropDownDefaultWidth||120;noCancel=this._trigger(this.events.filterDialogFilterAdding,null,{filtersTableBody:tableBody,owner:this});if(noCancel){rows=this._getFilterDialog().find("[data-af-row]");if(!rows.length){rows=tableBody.children()}if(rows.length>=this.options.filterDialogMaxFilterCount){this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog_error").show();return}if(expression===undefined){col=this.grid.columnByKey(this._dialogCurrentColumn);field=col.headerText;if(this._dialogCurrentType==="object"){this._dialogCurrentType=this._getColType(this._dialogCurrentColumn)}type=this._dialogCurrentType}else{col=this.grid.columnByKey(expression.fieldName);if(col!==null){field=col.headerText;if(col.dataType==="object"){type=this._getColType(expression.fieldName)}else{type=col.dataType}}condition=this._resolveConditionNameFromExpression(expression);defaultValue=expression.expr;if((type==="date"||type==="time")&&$.type(defaultValue)==="number"&&this.grid.options.enableUTCDates){defaultValue=new Date(defaultValue)}}if(this.options.filterDialogFilterTemplate&&typeof this.options.filterDialogFilterTemplate==="string"){filterRow=$(this._fTmplWrappers[this.grid.id()+"_filterDialogFilterTemplate"](filterObj))}else{filterRow=$("<tr data-af-row><td><input data-af-col/></td>"+"<td><input data-af-cond tabindex='"+this._getNextTabIndex()+"' title='"+this._getLocaleValue("filterDialogConditionDropDownLabel")+"' data-localeid='filterDialogConditionDropDownLabel' "+"data-localeattr='title' "+"/></td><td><input data-af-expr /> "+"</td><td><span data-af-rmv></span></td></tr>")}filterRow.appendTo(tableBody);colKeys=[];colTexts=[];for(i=0;i<cs.length;i++){if(cs[i].columnKey===col.key&&cs[i].allowFiltering===false){shouldDisable=true}else if(cs[i].allowFiltering===true){colTexts.push(this.grid.columnByKey(cs[i].columnKey).headerText);colKeys.push(cs[i].columnKey)}}cnd=this._getDialogCondSelByRow(filterRow);this._getDialogColSelByRow(filterRow).igTextEditor({language:this.grid.options.language,preventSubmitOnEnter:true,listItems:colTexts,disabled:shouldDisable,button:"dropdown",isLimitedToListValues:true,allowNullValue:false,buttonType:"dropdown",width:editorWidth,valueChanged:$.proxy(this._polulateFilterConditionDropDown,this),dropDownAttachedToBody:true,value:field,tabIndex:this._getNextTabIndex(),validatorOptions:{notificationOptions:{appendTo:"#"+this.grid.container().attr("id")+"_dialog",maxWidth:editorWidth}},rendering:function(evt,ui){ui.owner._updateDropdownSelection=$.proxy(owner._updateDropdownSelection,ui.owner,ui.owner._updateDropdownSelection)},rendered:function(evt,ui){$.each(ui.owner._listItems(),function(index,item){$(item).data("colKey",colKeys[index]);if(colKeys[index]===col.key){ui.owner._setSelectedItemByIndex(index)}})}});conds=this._populateConditionsList(col.key,this._getColType(col.key));this._renderAdvancedConditionsDropDown(cnd,conds,this._getIntialConditionForCol(cs,col.key));if(condition!==undefined&&cnd.length>0){matchingConditions=conds.filter(function(c){return c.condition===condition});cnd.igTextEditor("value",matchingConditions.length>0?matchingConditions[0].text:condition)}cnd.attr("disabled",shouldDisable);cnd.bind("igtexteditordropdownitemselected",$.proxy(this._changeFilterCondition,this));input=this._getDialogExprSelByRow(filterRow);this._populateFilterDialogInput(input,type,defaultValue,col,condition,shouldDisable);input.attr("disabled",shouldDisable);if(cnd.length&&!this.requiresFilteringExpression(condition)){this._dialogCurrentColumn=this._dialogCurrentColumn||col.key;this._changeFilterCondition({target:cnd[0],initCond:this._getIntialConditionForCol(cs,col.key)})}this._getDialogRmvBtnByRow(filterRow).attr("tabindex",this._getNextTabIndex()).addClass(this.css.filterDialogFilterRemoveButton).bind({mousedown:$.proxy(this._removeFilterFromDialog,this)});this._trigger(this.events.filterDialogFilterAdded,null,{filter:filterRow,owner:this})}},_updateDropdownSelection:function(origHandler,value){var current=this.getSelectedListItem(),currentValue=current.text();if(currentValue!==""&&currentValue!==value){origHandler.call(this,value)}},_filterDialogClearAll:function(e){var tableBody=this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog table tbody");tableBody.empty();this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog_error").hide();if(e){e.preventDefault()}},_polulateFilterConditionDropDown:function(e,args){var selectedColName=args.newValue,conditionListElem,cols=this.grid.options.columns,type,input,i,col,conds,$tr,$target=$(e.target),cs=this.options.columnSettings;$tr=$target.closest("[data-af-row]");if(!$tr.length){$tr=$target.closest("tr")}conditionListElem=this._getDialogCondSelByRow($tr);input=this._getDialogExprSelByRow($tr);for(i=0;i<cols.length;i++){if(cols[i].headerText===selectedColName){type=cols[i].dataType;col=cols[i];break}}if(type==="object"){type=this._getColType(col.key)}if(type===undefined){return}conds=this._populateConditionsList(col.key,type);this._renderAdvancedConditionsDropDown(conditionListElem,conds,this._getIntialConditionForCol(cs,col.key));this._populateFilterDialogInput(input,type,undefined,col,conds[0].condition)},_populateFilterDialogInput:function(input,type,defaultValue,col,condition){var options,provider,oldInputProvider,isCustomProvider=true,editorCallbacks={keyDown:$.noop,textChanged:$.noop,valueChanged:$.noop},colSetting=this._findColumnSetting(col.key),editorOptions=colSetting?colSetting.editorOptions||{}:{},editorType=colSetting?this._getEditorProviderType(col.dataType,colSetting.editorType):null;provider=colSetting?colSetting.editorProvider:null;if(!provider){provider=$.ig.GetEditorProvider(this.grid,col,editorType);isCustomProvider=false}options=$.extend({},editorOptions,{language:this.grid.options.language,regional:col.regional||this.grid.options.regional,preventSubmitOnEnter:true,suppressNotifications:true,tabIndex:this._getNextTabIndex(),buttonHidden:type!=="date",button:"dropdown",readOnly:this._isBool(type),maxDecimals:12,textAlign:type==="number"?"right":"left",width:this.options.filterDialogExprInputDefaultWidth,value:defaultValue,enableUTCDates:this.options.type==="remote"?true:this.grid.options.enableUTCDates});if(type==="date"||type==="time"){if(col&&col.format){options.dateInputFormat=col.format}options.displayTimeOffset=this.options.type==="remote"?0:this.grid._calcOffsetForCol(null,col)}if(!input.is("input")){input=input.find("INPUT").eq(0)}oldInputProvider=input.data("provider");if(oldInputProvider){oldInputProvider.destroy()}provider.createEditor(editorCallbacks,col.key,options,this._getNextTabIndex(),col.format,input,this.options.type==="remote"?0:this.grid._calcOffsetForCol(null,col));input.data("provider",provider);input.data("colKey",col.key);if(isCustomProvider){provider.setValue(defaultValue)}if(condition){this._setFilterDialogInput(input,condition)}},_getEditorProviderType:function(colType,editorType){if(!editorType&&colType==="date"){editorType="datepicker"}if(colType==="time"&&editorType!=="timepicker"&&editorType!=="date"){editorType="timepicker"}if(!editorType&&(colType==="bool"||colType==="boolean")){editorType="text"}return editorType},_populateConditionsList:function(selectedColKey,type){var conditions=[],i,j,cs=this.options.columnSettings,css=this.css,validConditions=[],matchingCondition,custConds,curCond,newCond,key;if(type==="number"){validConditions.push({condition:"equals",text:this._getLocaleValue("equalsLabel"),imgClass:css.filterItemIconEquals});validConditions.push({condition:"doesNotEqual",text:this._getLocaleValue("doesNotEqualLabel"),imgClass:css.filterItemIconDoesNotEqual});validConditions.push({condition:"greaterThan",text:this._getLocaleValue("greaterThanLabel"),imgClass:css.filterItemIconGreaterThan});validConditions.push({condition:"lessThan",text:this._getLocaleValue("lessThanLabel"),imgClass:css.filterItemIconLessThan});validConditions.push({condition:"greaterThanOrEqualTo",text:this._getLocaleValue("greaterThanOrEqualToLabel"),imgClass:css.filterItemIconGreaterThanOrEqualTo});validConditions.push({condition:"lessThanOrEqualTo",text:this._getLocaleValue("lessThanOrEqualToLabel"),imgClass:css.filterItemIconLessThanOrEqualTo})}else if(this._isBool(type)){validConditions.push({condition:"true",text:this._getLocaleValue("trueLabel"),imgClass:css.filterItemIconTrue});validConditions.push({condition:"false",text:this._getLocaleValue("falseLabel"),imgClass:css.filterItemIconFalse})}else if(type==="date"){validConditions.push({condition:"on",text:this._getLocaleValue("onLabel"),imgClass:css.filterItemIconOn});validConditions.push({condition:"notOn",text:this._getLocaleValue("notOnLabel"),imgClass:css.filterItemIconNotOn});validConditions.push({condition:"after",text:this._getLocaleValue("afterLabel"),imgClass:css.filterItemIconAfter});validConditions.push({condition:"before",text:this._getLocaleValue("beforeLabel"),imgClass:css.filterItemIconBefore});validConditions.push({condition:"today",text:this._getLocaleValue("todayLabel"),imgClass:css.filterItemIconToday});validConditions.push({condition:"yesterday",text:this._getLocaleValue("yesterdayLabel"),imgClass:css.filterItemIconYesterday});validConditions.push({condition:"thisMonth",text:this._getLocaleValue("thisMonthLabel"),imgClass:css.filterItemIconThisMonth});validConditions.push({condition:"lastMonth",text:this._getLocaleValue("lastMonthLabel"),imgClass:css.filterItemIconLastMonth});validConditions.push({condition:"nextMonth",text:this._getLocaleValue("nextMonthLabel"),imgClass:css.filterItemIconNextMonth});validConditions.push({condition:"thisYear",text:this._getLocaleValue("thisYearLabel"),imgClass:css.filterItemIconThisYear});validConditions.push({condition:"lastYear",text:this._getLocaleValue("lastYearLabel"),imgClass:css.filterItemIconLastYear});validConditions.push({condition:"nextYear",text:this._getLocaleValue("nextYearLabel"),imgClass:css.filterItemIconNextYear})}else if(type==="time"){validConditions.push({condition:"at",text:this._getLocaleValue("atLabel"),imgClass:css.filterItemIconOn});validConditions.push({condition:"notAt",text:this._getLocaleValue("notAtLabel"),imgClass:css.filterItemIconNotOn});validConditions.push({condition:"before",text:this._getLocaleValue("beforeLabel"),imgClass:css.filterItemIconBefore});validConditions.push({condition:"after",text:this._getLocaleValue("afterLabel"),imgClass:css.filterItemIconAfter});validConditions.push({condition:"atBefore",text:this._getLocaleValue("atBeforeLabel"),imgClass:css.filterItemIconToday});validConditions.push({condition:"atAfter",text:this._getLocaleValue("atAfterLabel"),imgClass:css.filterItemIconYesterday})}else if(type==="string"){validConditions.push({condition:"startsWith",text:this._getLocaleValue("startsWithLabel"),imgClass:css.filterItemIconStartsWith});validConditions.push({condition:"endsWith",text:this._getLocaleValue("endsWithLabel"),imgClass:css.filterItemIconEndsWith});validConditions.push({condition:"contains",text:this._getLocaleValue("containsLabel"),imgClass:css.filterItemIconContains});validConditions.push({condition:"doesNotContain",text:this._getLocaleValue("doesNotContainLabel"),imgClass:css.filterItemIconDoesNotContain});validConditions.push({condition:"equals",text:this._getLocaleValue("equalsLabel"),imgClass:css.filterItemIconEquals});validConditions.push({condition:"doesNotEqual",text:this._getLocaleValue("doesNotEqualLabel"),imgClass:css.filterItemIconDoesNotEqual})}if(this.options.showEmptyConditions){validConditions.push({condition:"empty",text:this._getLocaleValue("emptyLabel"),imgClass:css.filterItemIcon});validConditions.push({condition:"notEmpty",text:this._getLocaleValue("notEmptyLabel"),imgClass:css.filterItemIcon})}if(this.options.showNullConditions){validConditions.push({condition:"null",text:this._getLocaleValue("nullLabel"),imgClass:css.filterItemIcon});validConditions.push({condition:"notNull",text:this._getLocaleValue("notNullLabel"),imgClass:css.filterItemIcon})}for(i=0;i<cs.length;++i){if(cs[i].columnKey===selectedColKey){cs=cs[i];break}}custConds=cs.customConditions;for(key in custConds){if(custConds.hasOwnProperty(key)){curCond=custConds[key];newCond={condition:cs.columnKey+"_"+key,text:curCond.labelText,imgClass:curCond.filterImgIcon};validConditions.push(newCond)}}if(cs.conditionList&&cs.conditionList.length>0){for(i=0;i<cs.conditionList.length;++i){matchingCondition=null;for(j=0;j<validConditions.length;++j){if(validConditions[j].condition===cs.conditionList[i]||validConditions[j].condition===cs.columnKey+"_"+cs.conditionList[i]){matchingCondition=validConditions[j];break}}if(!matchingCondition){throw new Error($.ig.util.stringFormat(this._getLocaleValue("conditionNotValidForColumnType"),cs.conditionList[i],type))}conditions.push(matchingCondition)}}else{for(i=0;i<validConditions.length;++i){conditions.push(validConditions[i])}}return conditions},_renderAdvancedConditionsDropDown:function(conditionListElem,conditions,initCond){var i,condList=[],editorWidth=this.options.filterDialogFilterDropDownDefaultWidth||120,cond=conditions.filter(function(obj){return obj.condition===initCond});if(cond.length!==0){cond=cond[0].text}else{cond=conditions[0].text}conditionListElem.empty();if(this.options.filterDialogFilterConditionTemplate&&typeof this.options.filterDialogFilterConditionTemplate==="string"){condList=$(this._fTmplWrappers[this.grid.id()+"_filterDialogFilterConditionTemplate"](conditions));condList.appendTo(conditionListElem)}else{for(i=0;i<conditions.length;i++){condList.push(conditions[i].text)}conditionListElem.igTextEditor({language:this.grid.options.language,preventSubmitOnEnter:true,listItems:condList,button:"dropdown",isLimitedToListValues:true,allowNullValue:false,buttonType:"dropdown",width:editorWidth,dropDownAttachedToBody:true,value:cond,validatorOptions:{notificationOptions:{appendTo:"#"+this.grid.container().attr("id")+"_dialog",maxWidth:editorWidth}}})}},_removeFilterFromDialog:function(e){var filterR,$target=$(e.target),$tr=$target.closest("[data-af-row]");if(!$tr.length){$target.closest("tr").remove();filterR=this._getFilterDialog().find("tr")}else{$tr.remove();filterR=this._getFilterDialog().find("[data-af-row]")}if(filterR.length<this.options.filterDialogMaxFilterCount){this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_dialog_error").hide()}},_renderDropDownToList:function(obj,list,ul){var i,cond,classes,liHtml="",c;for(i=0;i<list.length;i++){classes=list[i].itemClass!==undefined?obj.itemClass+" "+list[i].itemClass:obj.itemClass;c=list[i].condition;cond="<li class='"+classes+"' tabindex='"+this.grid.options.tabIndex+"' data-cond='"+(c||"")+"'><span class='"+obj.imgContainerClass+"'>"+"<span class='"+this.css.filterItemIcon+" "+list[i].imgClass+"'></span></span>"+"<span class='"+obj.textClass+"' "+"data-localeid='"+(c?c+"Label":list[i].localeId)+"'>"+list[i].text+"</span></li>";liHtml+=cond}ul.append(liHtml)},_checkCloseDropDown:function(evt){var colKey=$(evt.target).closest("ul").parent().attr("aria-describedby"),colIndex;if(!$(evt.target).closest("ul").data("focussed")&&!this._cancelNextBlur&&this.options){$.each(this.options.columnSettings,function(index,col){if(col.columnKey===colKey){colIndex=index;return false}});this._closeDropDown({target:this._editorProviders[colIndex].getEditor().element,currentTarget:this._editorProviders[colIndex].getEditor().element})}else if(this._cancelNextBlur){this.grid._rootContainer().find("#"+this.grid.id()+"_dd_"+colKey+"_button").focus();this._cancelNextBlur=false}},_renderDropDownElement:function(id,colName){var ul,container;ul=$("<ul></ul>").appendTo(this.grid._rootContainer()).addClass(this.css.filterDropDownList);container=$("<div></div>").appendTo(this.grid._rootContainer()).attr({id:id,"data-filter-dropdown":true,"aria-describedBy":colName}).addClass(this.css.filterDropDown).css("overflow","hidden").css("position","absolute").hide();if(!$.ig.util.isIE){container.css("overflow-y","auto")}container.remove();if(this.options.filterDropDownWidth>0){ul.css("width",this.options.filterDropDownWidth)}if(this.options.filterDropDownHeight>0){container.css("height",this.options.filterDropDownHeight)}ul.data("colName",colName);ul.wrap(container);ul.parent().data("efh","1");this.grid._rootContainer().find("#"+id).delegate("li",{mousedown:$.proxy(this._selectDropDownItem,this),mouseover:$.proxy(this._hoverDropDownItem,this),mouseout:$.proxy(this._unhoverDropDownItem,this)});return ul},_hoverButton:function(event){var $target=$(event.currentTarget).find("span");if(this.options.mode==="advanced"){$target.addClass(this.css.filterButtonAdvancedHover)}else{$target.addClass(this.css.filterButtonHover)}},_unhoverButton:function(event){var $target=$(event.currentTarget).find("span");if(this.options.mode==="advanced"){$target.removeClass(this.css.filterButtonAdvancedHover)}else{$target.removeClass(this.css.filterButtonHover)}},_activateButton:function(event){var $target=$(event.currentTarget).find("span"),dd=this.grid._rootContainer().find("#"+this.grid.id()+"_filtering_dd");
dd.data("focussed",true);if(this._dontApplyStyles){this._dontApplyStyles=false;return}if(this.options.mode==="advanced"){$target.addClass(this.css.filterButtonAdvancedActive)}else{$target.addClass(this.css.filterButtonActive)}},_deactivateButton:function(event){var target=$(event.target).find("span"),self=this,id=$(event.target).attr("id")||$(event.currentTarget).attr("id"),ddId,dd,closeOnBlurTO,colKey,index;if(this.options.mode==="advanced"&&!this.options.advancedModeEditorsVisible){target.removeClass(this.css.filterButtonAdvancedActive)}else{ddId=this.grid.id()+"_filtering_dd";dd=this.grid._rootContainer().find("#"+ddId).find("ul");index=(this.grid.id()+"_dd_").length;colKey=id.substring(index,id.lastIndexOf("_button"));dd.data("focussed",false);closeOnBlurTO=this._animating&&colKey===this._animatingId?this.options.filterDropDownAnimationDuration:0;if(colKey===this._animatingId){setTimeout(function(){self._checkCloseDropDown({target:dd,currentTarget:dd})},closeOnBlurTO)}target.removeClass(this.css.filterButtonActive)}},_toggleDropDown:function(event,close,dontFocus){var $target=$(event.currentTarget),colKey=this.grid.getColumnByTD($target.closest("td")).column.key,id=this.grid.id()+"_filtering_dd",maxZ,dd,left,top,noCancel=true,button=$target,rOffset,block=this.grid._rootContainer().find("#"+this.grid.container().attr("id")+"_block"),dialog=this._getFilterDialog();if(this._animating&&(id===this._animatingId||colKey===this._animatingId)){return}maxZ=$.ig.getMaxZIndex(this.grid.container().attr("id")+"_dialog");block.css("zIndex",maxZ+1);dialog.css("zIndex",maxZ+2);dd=this.grid._rootContainer().find("#"+id);this._isClosing=false;if(dd.attr("aria-describedby")===colKey&&dd.is(":visible")){this._isClosing=true}dd.attr("aria-describedby",colKey);if(!this._isClosing&&noCancel){$(dd.children()[0]).empty();this._renderDropDown(this._getColType(colKey),this.grid.id()+"_dd_filtering",colKey);if(!close){noCancel=this._trigger(this.events.dropDownOpening,null,{dropDown:dd,owner:this})}}if(dd.is(":visible")){noCancel=this._trigger(this.events.dropDownClosing,null,{dropDown:dd,owner:this})}dd.css("zIndex",maxZ+3);if(!(!dd.is(":visible")&&close===true)){this._animating=true;this._animatingId=colKey}if(this._openingAnimation!==true){this._dontFocus=dontFocus}else{this._dontFocus=null}if(dd.find("ul > li").length===0){return}if(noCancel){left=$.ig.util.offset(button).left;top=$.ig.util.offset(button).top+button.outerHeight();if(dd.igOffset().left!==left||dd.igOffset().top!==top){rOffset=$.ig.util.getRelativeOffset(dd);left-=rOffset.left;top-=rOffset.top;dd.css("left",left).css("top",top)}this._currentTarget=$target;this._dd=dd;if(!this._isClosing){this._opendd=dd}if($.ig.util.isIE){dd.css("overflow-x","hidden");dd.css("overflow-y","hidden")}if(close!==undefined&&close===true){if(dd.is(":visible")){if(this.options.filterDropDownAnimations!=="none"){dd.hide(this.options.filterDropDownAnimationDuration,$.proxy(this._animationEnd,this))}else{dd.hide();this._trigger(this.events.dropDownClosed,null,{dropDown:dd,owner:this})}}}else{if(this.options.filterDropDownAnimations!=="none"){if(dd.is(":visible")&&!this._isClosing){if(noCancel){dd.hide();this._trigger(this.events.dropDownClosed,null,{dropDown:dd,owner:this})}else{return}}this._openingTarget=this._currentTarget;this._openingAnimation=true;dd.toggle(this.options.filterDropDownAnimationDuration,$.proxy(this._animationEnd,this))}else{dd.toggle();if(this._isClosing){this._trigger(this.events.dropDownClosed,null,{dropDown:dd,owner:this})}else{this._trigger(this.events.dropDownOpened,null,{dropDown:dd,owner:this});dd.scrollTop(0)}if(dontFocus!==true){this._dontApplyStyles=true;$target.focus()}}}}if($.type(event.stopPropagation)==="function"){event.stopPropagation()}},_animationEnd:function(){if(this.options===null){return}if(this._isClosing===true){this._trigger(this.events.dropDownClosed,null,{dropDown:this._dd,owner:this})}else{this._trigger(this.events.dropDownOpened,null,{dropDown:this._opendd,owner:this});this._openingAnimation=false;this._dd.scrollTop(0)}if(this._dd&&$.ig.util.isIE){this._dd.css("overflow-y","auto")}this._isClosing=null;if(this._dontFocus!==true){this._dontApplyStyles=true}this._animating=false},_toggleDropDownKeyboard:function(event){var parent,selectedItem,$target=$(event.target),ddVisible,dd=$("#"+this.grid.id()+"_filtering_dd").find("ul");if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){if(!$target.is("input")){event.stopPropagation();event.preventDefault()}parent=dd;if(parent.data("selectedItem")||parent.data("selectedItem")===0){selectedItem=parent.find("li:nth-child("+(parent.data("selectedItem")+1)+")");ddVisible=$("#"+this.grid.id()+"_filtering_dd").find("ul").is(":visible");if($(selectedItem).hasClass("ui-iggrid-filterddlistitemadvanced")&&ddVisible){this._openFilterDialog(event)}}if(selectedItem&&ddVisible){event.currentTarget=selectedItem;this._selectDropDownItem(event)}else{this._toggleDropDown(event)}}else if(event.keyCode===$.ui.keyCode.DOWN||event.keyCode===$.ui.keyCode.UP){this._handleKeyboardNavigation(event)}else if($.ui.keyCode.TAB){this._toggleDropDown(event,true)}},_handleKeyboardNavigation:function(event){var $target=$(event.target),dd,colKey;if($target.is("a")||$target.is("input")){colKey=this.grid.getColumnByTD($target.closest("td")).column.key;dd=$("#"+this.grid.id()+"_filtering_dd").find("ul");$target=dd.find("li.ui-iggrid-filterddlistitemactive").length>0?dd.find("li.ui-iggrid-filterddlistitemactive"):dd}event.stopPropagation();event.preventDefault();if(event.keyCode===$.ui.keyCode.DOWN){this._selectDropDownItem({currentTarget:$target},"next")}else if(event.keyCode===$.ui.keyCode.UP){this._selectDropDownItem({currentTarget:$target},"prev")}},_changeSelectionKeyboard:function(event){var buttonId,$target,prevElem;if(event.keyCode===$.ui.keyCode.DOWN||event.keyCode===$.ui.keyCode.UP){this._handleKeyboardNavigation(event)}else if(event.keyCode===$.ui.keyCode.ENTER){event.stopPropagation();event.preventDefault();this._selectDropDownItem(event)}else if(event.keyCode===$.ui.keyCode.TAB){event.stopPropagation();event.preventDefault();buttonId=this.grid.id()+"_dd_"+$(event.target).closest("div").attr("aria-describedby")+"_button";$target=this.grid.container().find("#"+buttonId);if(!event.shiftKey){$target.closest("td").find("input:tabbable").focus()}else{prevElem=$target.closest("td").prev("td");if(prevElem.length===0){prevElem=$target.closest("tr").prev()}prevElem.find(":tabbable").last().focus()}}},_closeDropDown:function(event){var curTarget=$(event.currentTarget),id=this.grid.id()+"_filtering_dd",closestUL=curTarget.closest("ul"),$target=curTarget.find("span"),dd;if(this._openingTarget&&event.target.id===this._openingTarget.attr("id")&&this._openingAnimation===true){return}dd=closestUL.length!==0?closestUL.closest("ul"):this.grid._rootContainer().find("#"+id);if(dd&&!dd.is(":visible")){$target.removeClass(this.css.filterButtonActive);return}this._toggleDropDown({currentTarget:event.currentTarget},true,true);if(this._dontApplyStyles){this._dontApplyStyles=false;return}if(this.options.mode==="advanced"){$target.removeClass(this.css.filterButtonAdvancedActive)}else{$target.removeClass(this.css.filterButtonActive)}},_getColType:function(colkey){var type=this.grid.dataSource._getFieldTypeFromSchema(colkey);if(type===undefined){type=this.grid.columnByKey(colkey).dataType}return type},_hasEditor:function(editorProvider){return $.type(editorProvider.getEditor)==="function"},_selectDropDownItem:function(event,nav,expr){var $target=$(event.currentTarget),filterCondition,colIndex,sel,parent,requiresEntry,button,currentCond,targetParent,evtArgs,focT,type,colKey,colType,currEditorProvider,editor,clearButton;if($target.find("input").length>0&&this.options.mode==="advanced"&&!this.options.advancedModeEditorsVisible){return}if(nav==="next"||nav==="prev"){parent=$target.parent()}if(nav==="next"){if(parent.data("selectedItem")===undefined){$target=parent.find("li:first")}else{$target=parent.find("li:nth-child("+(parent.data("selectedItem")+1)+")");if($target.next().length===0){$target=parent.find("li:first")}else{$target=$target.next()}}}if(nav==="prev"){if(parent.data("selectedItem")===undefined){$target=parent.find("li:last")}else{$target=parent.find("li:nth-child("+(parent.data("selectedItem")+1)+")");if($target.prev().length===0){$target=parent.find("li:last")}else{$target=$target.prev()}}}filterCondition=$target.attr("data-cond");colKey=$target.closest("div").attr("aria-describedBy");button=this.grid._rootContainer().find("#"+this.grid.id()+"_dd_"+colKey+"_button");if($target.attr("data-cond")===""||$target.attr("data-cond")===undefined){button.attr("title",this._getLocaleValue("tooltipTemplate").replace("${condition}",this._getLocaleValue("noFilterLabel")))}$.each(this.options.columnSettings,function(index,col){if(col.columnKey===colKey){colIndex=index;return false}});if(!colIndex&&expr){$.each(this.options.columnSettings,function(index,col){if(col.columnKey===expr.fieldName){colIndex=index;return false}})}currentCond=this.options.columnSettings[parseInt(colIndex,10)].condition;targetParent=$target.parent();sel=targetParent.data("selectedItem");type=this._getColType(this.grid.options.columns[colIndex].key);requiresEntry=this.requiresFilteringExpression(filterCondition);if($target[0]!==document.activeElement){$target.parent().data("focussed",true);$target.focus()}if(filterCondition!==undefined&&filterCondition!==""){this.options.columnSettings[parseInt(colIndex,10)].condition=filterCondition;if(sel!==undefined){targetParent.find("li:nth-child("+(sel+1)+")").removeClass(this.css.filterDropDownListItemActive)}$target.addClass(this.css.filterDropDownListItemActive);targetParent.data("selectedItem",$("li",targetParent).index($target));this._setEditorOption(this._editorProviders[colIndex].getEditor(),"placeHolder",this._getNullTextByCondition(filterCondition))}else if(currentCond==="empty"||currentCond==="notEmpty"||currentCond==="null"||currentCond==="notNull"||!this.requiresFilteringExpression(currentCond)){this.options.columnSettings[parseInt(colIndex,10)].condition=this._getDefaultCondition(type);if(sel!==undefined){targetParent.find("li:nth-child("+(sel+1)+")").removeClass(this.css.filterDropDownListItemActive);targetParent.data("selectedItem",null);if(this._isBool(this.grid.options.columns[colIndex].dataType)){this._setEditorOption(this._editorProviders[colIndex].getEditor(),"placeHolder","")}else{this._setEditorOption(this._editorProviders[colIndex].getEditor(),"placeHolder",this._getNullTextByCondition(this._getDefaultCondition(type)))}}if(currentCond==="null"||this.grid.options.columns[colIndex].dataType==="date"||this.grid.options.columns[colIndex].dataType==="time"){this._setEditorOption(this._editorProviders[colIndex].getEditor(),"placeHolder",this._getNullTextByCondition(this._getDefaultCondition(type)))}}if($target.hasClass("ui-iggrid-filterddlistitemclear")){if(sel!==undefined){targetParent.find("li:nth-child("+(sel+1)+")").removeClass(this.css.filterDropDownListItemActive)}$target.addClass(this.css.filterDropDownListItemActive);targetParent.data("selectedItem",$("li",targetParent).index($target))}currEditorProvider=this._editorProviders[colIndex];editor=currEditorProvider.getEditor();if(nav===undefined||event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){if($target.hasClass("ui-iggrid-filterddlistitemclear")||this.options.filterDropDownItemIcons===true&&$target.find(".ui-iggrid-filtericonclear").length>0){if(!requiresEntry||filterCondition===undefined||filterCondition===""){colType=this._getColType(this.grid.options.columns[colIndex].key);this._setEditorOption(editor,"readOnly",this._isBool(colType))}currEditorProvider.setValue(null);this._filterDataSourceClear(this.grid.options.columns[colIndex].key,colIndex);this._toggleDropDown({currentTarget:editor.element},true);button.focus()}else{if(!requiresEntry&&!expr){this._setEditorOption(editor,"readOnly",true);this._editorValueForCondition(filterCondition,currEditorProvider);clearButton=this._editorProviders[colIndex].editor.clearButton();if(clearButton.attr("id")&&clearButton.attr("id").indexOf("clearButton")!==-1){clearButton.hide()}this._args=undefined;this._filterInternal(colIndex,this.grid.options.columns[colIndex].key);button.focus()}else{var editorValue=this._getEditorVal(currEditorProvider);if(editorValue!==""&&editorValue!==null){if(editor.setFocus){editor.setFocus(true)}else if(editor.element.focus){editor.element.focus()}var editorDisplayValue=editor.displayValue?editor.displayValue():editorValue;evtArgs={owner:editor,text:editorDisplayValue};this._filter(event,evtArgs)}}if(requiresEntry){this._setEditorOption(editor,"readOnly",false);if(nav===undefined&&filterCondition!==undefined){focT=$.ig.util.isTouchDevice()?this.options.filterDropDownAnimationDuration:-1;if(editor.setFocus){editor.setFocus(focT)}else if(editor.element.focus){if(focT>0){setTimeout(function(){editor.element.focus()},focT)}else{editor.element.focus()}}}}}this._toggleDropDown({currentTarget:editor.element},true);$target.parent().data("focussed",false)}},requiresFilteringExpression:function(filterCondition){var custConds=this._dsTransformedCustomConditions;if(this.grid.dataSource._isFilteringExprNotReq(filterCondition)){return false}if(custConds&&custConds[filterCondition]){return custConds[filterCondition].requireExpr}if(filterCondition===undefined||filterCondition===null){return false}return true},_editorValueForCondition:function(filterCondition,editorProvider){var date=new Date,custConds=this._dsTransformedCustomConditions,colKey;if(filterCondition==="true"){editorProvider.setValue(this._getLocaleValue("trueLabel"))}else if(filterCondition==="false"){editorProvider.setValue(this._getLocaleValue("falseLabel"))}else if(filterCondition==="today"){colKey=editorProvider.getEditor().element.data("colKey");if(this.grid.columnByKey(colKey).dateDisplayType==="utc"){editorProvider.setValue(new Date(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate(),0,0,0,0)))}else{editorProvider.setValue(date)}}else if(filterCondition==="yesterday"){colKey=editorProvider.getEditor().element.data("colKey");if(this.grid.columnByKey(colKey).dateDisplayType==="utc"){editorProvider.setValue(new Date(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate()-1,0,0,0,0)))}else{editorProvider.setValue(new Date(date.getFullYear(),date.getMonth(),date.getDate()-1,0,0,0,0))}}else if(custConds&&custConds[filterCondition]){editorProvider.setValue(custConds[filterCondition].expressionText)}else{editorProvider.setValue(null)}},_assignTemplates:function(){var self=this,opts=self.options,gId=this.grid.id();this._fTmplWrappers={};this._fTmplWrappers[gId+"_filterDialogFilterTemplate"]=function(d){return $.ig.tmpl(opts.filterDialogFilterTemplate,d)};this._fTmplWrappers[gId+"_filterDialogAddConditionTemplate"]=function(d){return $.ig.tmpl(opts.filterDialogAddConditionTemplate,d)};this._fTmplWrappers[gId+"_filterDialogAddConditionDropDownTemplate"]=function(d){return $.ig.tmpl(opts.filterDialogAddConditionDropDownTemplate,d)};this._fTmplWrappers[gId+"_filterDialogFilterConditionTemplate"]=function(d){return $.ig.tmpl(opts.filterDialogFilterConditionTemplate,d)};if(String(this.grid.options.templatingEngine).toLowerCase()==="jsrender"){this._jsr=true;$.templates(gId+"_filterDialogFilterTemplate",opts.filterDialogFilterTemplate);$.templates(gId+"_filterDialogAddConditionTemplate",opts.filterDialogAddConditionTemplate);$.templates(gId+"_filterDialogAddConditionDropDownTemplate",opts.filterDialogAddConditionDropDownTemplate);$.templates(gId+"_filterDialogFilterConditionTemplate",opts.filterDialogFilterConditionTemplate);this._fTmplWrappers=$.render}},_hoverDropDownItem:function(event){if($(event.currentTarget).find("input").length===0){$(event.currentTarget).addClass(this.css.filterDropDownListItemHover)}},_unhoverDropDownItem:function(event){$(event.currentTarget).removeClass(this.css.filterDropDownListItemHover)},_virtualHorizontalScroll:function(event,args){var start=args.startColIndex,i,headers=this.grid.headersTable().find("th"),columnKey;if(this._currentTarget){this._toggleDropDown({currentTarget:this._currentTarget},true)}if(this.options.mode==="advanced"&&this.options.advancedModeEditorsVisible!==true){for(i=0;i<this.grid._virtualColumnCount;i++){columnKey=this.grid.options.columns[i+start].key;$(headers[i]).data("colName",columnKey);if(this._fcData[columnKey]===true){continue}$(headers[i]).find("a").attr("data-col-key",columnKey).attr("id",this.grid.element[0].id+"_dd_"+columnKey+"_button")}this._updateTooltips(this._currentAdvancedExpressions||[])}else{throw new Error(this._getLocaleValue("virtualizationSimpleFilteringNotAllowed"))}},_headerInit:function(owner,args){var filterrow;if(this.options.mode!=="simple"&&this.options.advancedModeEditorsVisible!==true||this.grid.element.attr("id")!==args.owner.element.attr("id")){return}filterrow=this.grid.headersTable().children("thead").find("[data-role=filterrow]");filterrow.find("[data-skip=true]").remove();this.grid._headerInit(filterrow,null,true)},_injectGrid:function(gridInstance){var topmostGrid=null;this.grid=gridInstance;if(this.options.type===null){this.options.type=this.grid._inferOpType()}if(this.options.persist&&this.options.type==="remote"){topmostGrid=this.element.closest(".ui-iggrid-root").data("igGrid");if(topmostGrid&&topmostGrid.element.attr("id")!==this.grid.element[0].id&&topmostGrid.options.initialDataBindDepth===-1){this.options.persist=false}}if(this.options.type){this.grid.dataSource.settings.filtering.type=this.options.type}else{this.grid.dataSource.settings.filtering.type="remote"}if(this.options.filterExprUrlKey){this.grid.dataSource.settings.filtering.filterExprUrlKey=this.options.filterExprUrlKey}this.grid.dataSource.settings.filtering.caseSensitive=this.options.caseSensitive;if(this._headerCellRenderedHandler!==null&&this._headerCellRenderedHandler!==undefined){this.grid.element.unbind("iggridheadercellrendered",this._headerCellRenderedHandler)}this._headerCellRenderedHandler=$.proxy(this._headerCellRendered,this);this.grid.element.bind("iggridheadercellrendered",this._headerCellRenderedHandler);if(this._headerRenderedHandler!==null&&this._headerRenderedHandler!==undefined){this.grid.element.unbind("iggridheaderrendered",this._headerRenderedHandler)}this._headerRenderedHandler=$.proxy(this._headerRendered,this);this.grid.element.bind("iggridheaderrendered",this._headerRenderedHandler);if(this._columnResizedHandler!==null&&this._columnResizedHandler!==undefined){this.grid.element.unbind("iggridresizingcolumnresized",this._columnResizedHandler)}this._columnResizedHandler=$.proxy(this._columnResized,this);this.grid.element.bind("iggridresizingcolumnresized",this._columnResizedHandler);if(this._columnsAlteredHandler!==null&&this._columnsAlteredHandler!==undefined){this.grid.element.unbind("iggrid_columnsmoved",this._columnsAlteredHandler)}this._columnsAlteredHandler=$.proxy(this._columnsAltered,this);this.grid.element.bind("iggrid_columnsmoved",this._columnsAlteredHandler);this._transformCustomConditionsForDataSource();this._initDefaultSettings();if(this._onUIDirtyHandler!==null&&this._onUIDirtyHandler!==undefined){this.grid.element.unbind("iggriduidirty",this._onUIDirtyHandler)}this._onUIDirtyHandler=$.proxy(this._onUIDirty,this);this.grid.element.bind("iggriduidirty",this._onUIDirtyHandler);if(this._virtualHorizontalScrollHandler!==null&&this._virtualHorizontalScrollHandler!==undefined){this.grid.element.unbind("iggridvirtualhorizontalscroll",this._virtualHorizontalScrollHandler)}this._virtualHorizontalScrollHandler=$.proxy(this._virtualHorizontalScroll,this);this.grid.element.bind("iggridvirtualhorizontalscroll",this._virtualHorizontalScrollHandler);if((this.grid.options.virtualization===true&&this.grid.options.width!==null||this.grid.options.columnVirtualization===true)&&this.options.mode===null){this.options.mode="advanced"}else if((this.grid.options.virtualization===false||this.grid.options.virtualization===true&&!this.grid._isColumnVirtualizationEnabled())&&(this.options.mode===null||this.options.mode==="simple")){this.options.mode="simple"}else if(this.options.mode==="simple"&&(this.grid.options.virtualization===true||this.grid.options.columnVirtualization===true)){throw new Error(this._getLocaleValue("virtualizationSimpleFilteringNotAllowed"))}if(this.grid._rlp&&(this.options.mode==="simple"||!this.options.mode)){throw new Error(this._getLocaleValue("multiRowLayoutSimpleFilteringNotAllowed"))}if(this._headerInitHandler!==null&&this._headerInitHandler!==undefined){this.grid.element.unbind("iggridheaderextracellsmodified",this._headerInitHandler)}this._headerInitHandler=$.proxy(this._headerInit,this);this.grid.element.bind("iggridheaderextracellsmodified",this._headerInitHandler);if(this._dataBoundHandler!==null&&this._dataBoundHandler!==undefined){this.grid.element.unbind("iggriddatabound",this._dataBoundHandler)}this._dataBoundHandler=$.proxy(this._dataBound,this);this.grid.element.bind("iggriddatabound",this._dataBoundHandler);if(this.grid.element.igGridFeatureChooser!==undefined){this.grid.element.igGridFeatureChooser()}else{throw new Error(this._getLocaleValue("featureChooserNotReferenced"))}this._assignTemplates();if(this.options.persist){this._preserveFiltering()}}});$.extend($.ui.igGridFiltering,{version:"21.2.12"});return $});