/*!@license
 * Infragistics.Web.ClientUI Grid Sorting 15.2.20152.1027
 *
 * Copyright (c) 2011-2015 Infragistics Inc.
 *
 * http://www.infragistics.com/
 *
 * Depends on:
 *	jquery-1.9.1.js
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.mouse.js
 *	jquery.ui.draggable.js
 *	jquery.ui.resizable.js
 *	modernizr.js (Optional)
 *	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
 */
if(typeof jQuery!=="function"){throw new Error("jQuery is undefined")}(function($){$.widget("ui.igGridFiltering",{renderInFeatureChooser:true,options:{caseSensitive:false,filterSummaryAlwaysVisible:true,renderFC:true,filterSummaryTemplate:$.ig.GridFiltering.locale.filterSummaryTemplate,filterDropDownAnimations:"linear",filterDropDownAnimationDuration:500,filterDropDownWidth:0,filterDropDownHeight:0,filterExprUrlKey:null,filterDropDownItemIcons:true,columnSettings:[{columnKey:null,columnIndex:null,allowFiltering:true,condition:null,conditionList:[],defaultExpressions:[],customConditions:null}],type:null,filterDelay:500,mode:null,advancedModeEditorsVisible:false,advancedModeHeaderButtonLocation:"left",filterDialogWidth:430,filterDialogHeight:"",filterDialogFilterDropDownDefaultWidth:80,filterDialogExprInputDefaultWidth:130,filterDialogColumnDropDownDefaultWidth:null,renderFilterButton:true,filterButtonLocation:"left",nullTexts:{startsWith:$.ig.GridFiltering.locale.startsWithNullText,endsWith:$.ig.GridFiltering.locale.endsWithNullText,contains:$.ig.GridFiltering.locale.containsNullText,doesNotContain:$.ig.GridFiltering.locale.doesNotContainNullText,equals:$.ig.GridFiltering.locale.equalsNullText,doesNotEqual:$.ig.GridFiltering.locale.doesNotEqualNullText,greaterThan:$.ig.GridFiltering.locale.greaterThanNullText,lessThan:$.ig.GridFiltering.locale.lessThanNullText,greaterThanOrEqualTo:$.ig.GridFiltering.locale.greaterThanOrEqualToNullText,lessThanOrEqualTo:$.ig.GridFiltering.locale.lessThanOrEqualToNullText,on:$.ig.GridFiltering.locale.onNullText,notOn:$.ig.GridFiltering.locale.notOnNullText,after:$.ig.GridFiltering.locale.afterNullText,before:$.ig.GridFiltering.locale.beforeNullText,thisMonth:$.ig.GridFiltering.locale.thisMonthLabel,lastMonth:$.ig.GridFiltering.locale.lastMonthLabel,nextMonth:$.ig.GridFiltering.locale.nextMonthLabel,thisYear:$.ig.GridFiltering.locale.thisYearLabel,lastYear:$.ig.GridFiltering.locale.lastYearLabel,nextYear:$.ig.GridFiltering.locale.nextYearLabel,empty:$.ig.GridFiltering.locale.emptyNullText,notEmpty:$.ig.GridFiltering.locale.notEmptyNullText,"null":$.ig.GridFiltering.locale.nullNullText,notNull:$.ig.GridFiltering.locale.notNullNullText},labels:{noFilter:$.ig.GridFiltering.locale.noFilterLabel,clear:$.ig.GridFiltering.locale.clearLabel,startsWith:$.ig.GridFiltering.locale.startsWithLabel,endsWith:$.ig.GridFiltering.locale.endsWithLabel,contains:$.ig.GridFiltering.locale.containsLabel,doesNotContain:$.ig.GridFiltering.locale.doesNotContainLabel,equals:$.ig.GridFiltering.locale.equalsLabel,doesNotEqual:$.ig.GridFiltering.locale.doesNotEqualLabel,greaterThan:$.ig.GridFiltering.locale.greaterThanLabel,lessThan:$.ig.GridFiltering.locale.lessThanLabel,greaterThanOrEqualTo:$.ig.GridFiltering.locale.greaterThanOrEqualToLabel,lessThanOrEqualTo:$.ig.GridFiltering.locale.lessThanOrEqualToLabel,trueLabel:$.ig.GridFiltering.locale.trueLabel,falseLabel:$.ig.GridFiltering.locale.falseLabel,after:$.ig.GridFiltering.locale.afterLabel,before:$.ig.GridFiltering.locale.beforeLabel,today:$.ig.GridFiltering.locale.todayLabel,yesterday:$.ig.GridFiltering.locale.yesterdayLabel,thisMonth:$.ig.GridFiltering.locale.thisMonthLabel,lastMonth:$.ig.GridFiltering.locale.lastMonthLabel,nextMonth:$.ig.GridFiltering.locale.nextMonthLabel,thisYear:$.ig.GridFiltering.locale.thisYearLabel,lastYear:$.ig.GridFiltering.locale.lastYearLabel,nextYear:$.ig.GridFiltering.locale.nextYearLabel,on:$.ig.GridFiltering.locale.onLabel,notOn:$.ig.GridFiltering.locale.notOnLabel,advancedButtonLabel:$.ig.GridFiltering.locale.advancedButtonLabel,filterDialogCaptionLabel:$.ig.GridFiltering.locale.filterDialogCaptionLabel,filterDialogConditionLabel1:$.ig.GridFiltering.locale.filterDialogConditionLabel1,filterDialogConditionLabel2:$.ig.GridFiltering.locale.filterDialogConditionLabel2,filterDialogOkLabel:$.ig.GridFiltering.locale.filterDialogOkLabel,filterDialogCancelLabel:$.ig.GridFiltering.locale.filterDialogCancelLabel,filterDialogAnyLabel:$.ig.GridFiltering.locale.filterDialogAnyLabel,filterDialogAllLabel:$.ig.GridFiltering.locale.filterDialogAllLabel,filterDialogAddLabel:$.ig.GridFiltering.locale.filterDialogAddLabel,filterDialogErrorLabel:$.ig.GridFiltering.locale.filterDialogErrorLabel,filterSummaryTitleLabel:$.ig.GridFiltering.locale.filterSummaryTitleLabel,filterDialogClearAllLabel:$.ig.GridFiltering.locale.filterDialogClearAllLabel,empty:$.ig.GridFiltering.locale.emptyNullText,notEmpty:$.ig.GridFiltering.locale.notEmptyNullText,nullLabel:$.ig.GridFiltering.locale.nullNullText,notNull:$.ig.GridFiltering.locale.notNullNullText,"true":$.ig.GridFiltering.locale.trueLabel,"false":$.ig.GridFiltering.locale.falseLabel},tooltipTemplate:$.ig.GridFiltering.locale.tooltipTemplate,filterDialogAddConditionTemplate:null,filterDialogAddConditionDropDownTemplate:null,filterDialogFilterTemplate:null,filterDialogFilterConditionTemplate:null,filterDialogAddButtonWidth:100,filterDialogOkCancelButtonWidth:120,filterDialogMaxFilterCount:5,filterDialogContainment:"owner",showEmptyConditions:false,showNullConditions:false,featureChooserText:$.ig.GridFiltering.locale.featureChooserText,featureChooserTextHide:$.ig.GridFiltering.locale.featureChooserTextHide,featureChooserTextAdvancedFilter:$.ig.GridFiltering.locale.featureChooserTextAdvancedFilter,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",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"},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._editors=[];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"}},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key==="mode"||key==="renderFilterButton"||key==="filterButtonLocation"||key==="type"){throw new Error($.ig.Grid.locale.optionChangeNotSupported.replace("{optionName}",key))}if(key==="filterDropDownWidth"){this.grid.container().find("div ul").parent().css("width",value)}else if(key==="filterDropDownHeight"){this.grid.container().find("div ul").parent().css("height",value)}else if(key==="filterDialogWidth"){$("#"+this.grid.container().attr("id")+"_dialog").css("width",value)}else if(key==="filterDialogHeight"){$("#"+this.grid.container().attr("id")+"_dialog").css("height",value)}else if(key==="columnSettings"){this._initDefaultSettings()}},destroy:function(){var i,fc,cols=this.grid.options.columns,block=$("#"+this.grid.id()+"_container_block"),dialog=$("#"+this.grid.id()+"_container_dialog"),gridContainer=this.grid.container();$("#"+gridContainer[0].id+" .ui-iggrid-filterrow").remove();$("#"+gridContainer[0].id+" .ui-iggrid-filterdd").remove();for(i=0;i<cols.length;i++){$("#"+this.grid.id()+"_dd_"+cols[i].key).remove()}block.remove();dialog.remove();gridContainer.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("iggrid_columnsmoved",this._columnsAlteredHandler);this.grid.element.unbind("iggriduidirty",this._onUIDirtyHandler);delete this._headerCellRenderedHandler;delete this._headerRenderedHandler;delete this._virtualHorizontalScrollHandler;delete this._columnResizedHandler;delete this._headerInitHandler;delete this._onUIDirtyHandler;delete this._columnsAlteredHandler;this._editors=null;this._fcData=null;this.options.columnSettings=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")}$.Widget.prototype.destroy.call(this);return this},_initLoadingIndicator:function(){this._loadingIndicator=this.grid.container().length>0?this.grid.container().igLoading().data("igLoading"):this.grid.element.igLoading().data("igLoading").indicator()},_onUIDirty:function(e,args){if(this.options.persist&&this.options.type==="remote"){return}var i,cols=this.grid.options.columns,condition;if(args.owner===this||args.owner.element[0].id!==this.element[0].id){return}this._filterDialogClearAll();if(this._editors!==null&&this._editors!==undefined){for(i=0;i<this._editors.length;i++){if(this.options.columnSettings[i].allowFiltering!==false){this._editors[i].value(null);condition=null;if(this.options.columnSettings[i].columnKey){condition=this.options.nullTexts[this._findColumnSetting(this.options.columnSettings[i].columnKey).condition]}if(condition===null||condition===undefined){condition=this.options.nullTexts[this._getDefaultCondition(cols[i].dataType)]}this._editors[i].element.igGridFilterEditor("option","placeHolder",condition)}}}for(i=0;i<cols.length;i++){$("#"+this.grid.id()+"_dd_"+cols[i].key).find("li").removeClass("ui-iggrid-filterddlistitemactive ui-state-active")}$(".ui-iggrid-filterbutton",this.grid.container()).parent().attr("title",this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter));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 defExpr,expr,matches=0,grid=this.grid,summary=this.grid.container().find(".ui-iggrid-footer .ui-iggrid-results").eq(0),footer=summary.parent(),shouldInitHeights=false,isInitiallyFiltered=false,i,isFiltering=false,exprs;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._isFilteringRequest=true}if(this._shouldFireDataFiltered){exprs=this._getDataColumnFilteringExpressions(this.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._isFilteringRequest===true){if(this.options.filterSummaryAlwaysVisible===true&&summary.length===0){footer=$("<div></div>").appendTo(this.grid.container()).addClass("ui-widget ui-helper-clearfix ui-corner-bottom ui-widget-header ui-iggrid-footer");summary=$("<span></span>").appendTo(footer).addClass("ui-iggrid-results");if(isInitiallyFiltered&&this.grid.element.data("igGridPaging")){footer.attr("id",this.grid.element[0].id+"_pager").addClass("ui-iggrid-pager");summary.attr("id",this.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.options.filterSummaryTemplate.replace("${matches}",matches)).attr("title",this.options.labels.filterSummaryTitleLabel);summary.show();isFiltering=true;this._isFilteringRequest=false}else if(this._isFilteringRequest===false){expr=this.grid.dataSource.settings.filtering.expressions||[];if(summary.data("hideflag")!==false&&expr.length===0){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){this.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!==null&&fc!==undefined&&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:o.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:o.featureChooserText,textHide:o.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;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");cells.eq(i).children("span[data-filter-editor]").first().igGridFilterEditor("option","width",cellWidth)}},_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;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;for(i=0;i<cols.length;i++,ci++){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}}}}else{if(this.grid._isMultiColumnGrid){cell=$(this.grid._headerCells[ci])}else{cell=$(filterrow[0].cells[ci])}if(cell.children().first().is("a")){cell.children().first().css("display","inline");cell.css("cursor","pointer")}cell.data("colName",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._editors.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;if(this.options.advancedModeEditorsVisible===true||this.options.mode!=="advanced"){this._renderDropDown(cols[i].dataType,id,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" href="#" title="'+this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter)+'" ></a>')}else{button.wrap('<a id="'+id+'_button" href="#" title="'+this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter)+'" 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._closeDropDown,this),keydown:$.proxy(this._toggleDropDownKeyboard,this),mouseover:$.proxy(this._hoverButton,this),mouseout:$.proxy(this._unhoverButton,this),focus:$.proxy(this._activateButton,this)});if(document.documentMode===5||document.documentMode===7||$.ig.util.isIE7){button.parent().bind({focusout:$.proxy(this._closeDropDown,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.grid.container().attr("id")+"_dialog").length>0){$("#"+this.grid.container().attr("id")+"_dialog").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()}},_openFilterDialogFromFC:function(event,columnKey){this._openFilterDialog(event,columnKey)},toggleFilterRowByFeatureChooser:function(event){var fc,$filterRow,o=this.options,isShown=this._filterRowShown,$thead=this.grid.container().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(editor){if(editor._editorInput.is(":focus")&&editor.element.data("editorType")!=="igDatePicker"){editor._processValueChanging(editor._editorInput.val())}return editor.value()},_getEditorNameByColType:function(colType){if(colType==="date"||colType==="datetime"){return"igDatePicker"}if(colType==="number"||colType==="numeric"){return"igNumericEditor"}return"igTextEditor"},_createEditor:function(parent,w,colIndex,col){var $editor,colType,colKey,options,edtrType,self=this;colType=col.dataType;colKey=col.key;edtrType=this._getEditorNameByColType(colType);$editor=$("<span />").attr("data-filter-editor",true);if(this.options.filterButtonLocation==="left"){$editor.appendTo(parent)}else{$editor.prependTo(parent)}options={width:w,suppressNotifications:true,disabled:this.grid.options.columns[colIndex].dataType==="bool"||this.grid.options.columns[colIndex].dataType==="boolean",textAlign:"left",revertIfNotValid:false,placeHolder:this.options.nullTexts[this._findColumnSetting(colKey).condition],allowNullValue:true,rendered:function(e,args){var edtr=args.owner,$edtrCont=edtr.editorContainer(),$indCont=parent.find(".ui-iggrid-indicatorcontainer");if(self.grid.options.columns[colIndex].dataType==="bool"){edtr.field().removeClass("ui-state-disabled");edtr.editorContainer().removeClass("ui-state-disabled")}if(self.options.filterButtonLocation==="left"){$indCont.prependTo($edtrCont);$edtrCont.on({mousedown:function(e){if(edtr.options.disabled){self._toggleDropDown({currentTarget:$indCont.find("a")});e.stopPropagation()}}})}else{$indCont.appendTo($edtrCont)}}};$editor.data("colIndex",colIndex).data("colKey",colKey);if(colType==="date"||colType==="datetime"){options=$.extend({},options,{enableUTCDates:this.grid.options.enableUTCDates,valueChanged:$.proxy(this._filter,this),revertIfNotValid:false});if(col.format){options.dateInputFormat=col.format}}else{options.textChanged=$.proxy(this._filter,this)}$editor.data("editorType",edtrType);$editor.igGridFilterEditor(options);this._editors.push($editor.data(edtrType));$editor.find("input").addClass(this.css.filterCellEditor)},_columnFixed:function(args){var i,colInd=args.colInd,at=args.at,edtr,cs;cs=this.options.columnSettings[colInd];if(cs){if(at===undefined||at===null){at=args.fixedColsCount-1}this.options.columnSettings.splice(colInd,1);this.options.columnSettings.splice(at,0,cs);if(!this._editors||!this._editors.length||!this._editors[colInd]){return}edtr=this._editors.splice(colInd,1);this._editors.splice(at,0,edtr[0]);for(i=0;i<this._editors.length;i++){edtr=$(this._editors[i].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;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._editors,start,len,idx);for(i=0;i<this._editors.length;i++){$(this._editors[i].element).data("colIndex",i);$(this._editors[i].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){this._loadingIndicator.show();if(expressions!==undefined&&expressions.length>0){this._isFilteringRequest=true}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,editor,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();editor=this._editors?this._editors[_colIndex]:null;if(editor){editor._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,groupBy,cols=this.grid.options.columns,found=false,defaultTooltip,noCancel;defaultTooltip=this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter);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;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.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._requiresEntry(exprs[j].cond)){button.attr("title",defaultTooltip)}else{button.attr("title",this.options.tooltipTemplate.replace("${condition}",this.options.labels[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._isFilteringRequest=true;this._preserveSorting();if(exprs.length===0){if(!apiCall){this._shouldFireDataFiltered=true}if(this.options.type==="remote"){this._isFilteringRequest=false;this.grid.dataSource.dataBind()}else{this.grid.dataSource.settings.filtering.type="local";this._isFilteringRequest=false;this.grid.dataSource.clearLocalFilter();groupBy=this.grid.element.data("igGridGroupBy");if(groupBy&&groupBy.options&&groupBy.options.groupedColumns&&groupBy.options.groupedColumns.length>0){if(this.grid.dataSource.settings.sorting.expressions.length>0&&groupBy.options.type==="local"){this.grid.dataSource.sort(this.grid.dataSource.settings.sorting.expressions)}}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);groupBy=this.grid.element.data("igGridGroupBy");if(groupBy&&groupBy.options&&groupBy.options.groupedColumns&&groupBy.options.groupedColumns.length>0){if(this.grid.dataSource.settings.sorting.expressions.length>0&&groupBy.options.type==="local"&&this.grid.dataSource._allDataSorted===false){this.grid.dataSource.sort(this.grid.dataSource.settings.sorting.expressions)}}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._generateExpressions(true),noCancel,noCancelFiltering;for(i=0;i<exprs.length;i++){if(exprs[i].fieldName===colKey){$.ig.removeFromArray(exprs,i);break}}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}else{this._isFilteringRequest=false;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.grid.dataSource.filter(exprs)}else{this._isFilteringRequest=false;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");if(groupBy&&groupBy.options&&groupBy.options.groupedColumns&&groupBy.options.groupedColumns.length>0){hasGroupedCols=true}if(this.grid.dataSource.settings.sorting.expressions.length>0&&hasGroupedCols){this.grid.dataSource.settings.sorting.defaultFields=this.grid.dataSource.settings.sorting.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,j,editor,filterList,items,condName,$li,exprLen=expressions.length;if(this._editors){for(i=0;i<this._editors.length;i++){if(this.options.columnSettings[i].allowFiltering!==false){this._editors[i].value(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.element[0].id+"_dd_"+this.options.columnSettings[i].columnKey).find("ul").children().first();if($li.length){this._selectDropDownItem({currentTarget:$li},null)}}}}for(i=0;i<exprLen;i++){filterList=$("#"+this.grid.element[0].id+"_dd_"+expressions[i].fieldName).find("ul");items=filterList.children();condName=this._resolveConditionNameFromExpression(expressions[i]);for(j=0;j<items.length;j++){if($(items[j]).data("cond")===condName){this._selectDropDownItem({currentTarget:items[j]},null,expressions[i]);break}}editor=this._editors[this._columnIndexFromKey(expressions[i].fieldName)];if(editor!==undefined&&editor!==null&&editor.value){editor.value(expressions[i].expr);editor._addedFromAdvanced=true}}this._updateTooltips(expressions)},_updateTooltips:function(expressions){var button,title,found,titleText,tempTooltipExpr,cols=this.grid.options.columns,colsLength=cols.length,i,j,expressionFieldName,condName,conditionLabel,isSimpleMode=this.options.mode==="simple"||this.options.advancedModeEditorsVisible===true;titleText=this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter);title="";for(i=0;i<expressions.length;i++){button=$("#"+this.grid.element[0].id+"_dd_"+expressions[i].fieldName+"_button");if(!this._requiresEntry(expressions[i].cond)||expressions[i].expr===undefined||expressions[i].expr===null){tempTooltipExpr=""}else{tempTooltipExpr=expressions[i].expr;if(expressions[i].type==="date"){if($.type(tempTooltipExpr)==="number"){tempTooltipExpr=new Date(tempTooltipExpr)}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],expressionFieldName);conditionLabel=this.options.labels[condName];if(isSimpleMode){button.attr("title",this.options.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.element[0].id+"_dd_"+cols[i].key+"_button").attr("title",titleText)}}},_resolveConditionNameFromExpression:function(expression,fieldName){var j,expressionFieldName,custConds=this._dsTransformedCustomConditions,cols=this.grid.options.columns,colsLength=cols.length;if(fieldName){expressionFieldName=fieldName}else{expressionFieldName=expression.fieldName;for(j=0;j<colsLength;j++){if(cols[j].key===expressionFieldName){expressionFieldName=cols[j].headerText;break}}}if(custConds&&custConds[expressionFieldName+"_"+expression.cond]){return expressionFieldName+"_"+expression.cond}else{return expression.cond}},_columnIndexFromKey:function(key){var i;for(i=0;i<this.grid.options.columns.length;i++){if(this.grid.options.columns[i].key===key){return i}}},_generateExpressions:function(filterRowTrigger){var exprs=[],cols=this.grid.options.columns,expr,i,currentCondition,requiresEntry,isExprAdded,dt,defExpr,precise,format,preciseInd;for(i=0;i<cols.length;i++){if(this._editors&&this._editors[i]&&this._editors[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._editors[i]);currentCondition=this.options.columnSettings[i].condition}requiresEntry=this._requiresEntry(currentCondition);if(currentCondition===undefined||currentCondition===null||currentCondition===""){continue}if((expr===undefined||expr===null||expr==="")&&requiresEntry){continue}precise="";dt=cols[i].dataType;if(dt==="date"&&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(precise===""&&currentCondition==="after"&&$.type(expr)==="date"){expr.setHours(23);expr.setMinutes(59);expr.setSeconds(59);expr.setMilliseconds(999)}}}isExprAdded=false;if(dt!=="date"||dt==="date"&&expr!==null&&expr!==undefined&&currentCondition!=="empty"&&currentCondition!=="notEmpty"&&currentCondition!=="null"&&currentCondition!=="notNull"||dt==="date"&&!this._requiresEntry(currentCondition)){if(expr!==""&&dt!=="bool"&&!this.options.filterExprUrlKey){isExprAdded=true;exprs.push({fieldName:cols[i].key,cond:currentCondition,expr:expr})}else if(dt==="bool"&&expr!==""&&expr!==null||dt!=="bool"&&(this.options.filterExprUrlKey!==undefined&&this.options.filterExprUrlKey!==null||this.options.type==="local")){isExprAdded=true;exprs.push({fieldName:cols[i].key,cond:currentCondition,expr:expr})}else if(dt==="bool"&&(expr===""||expr===null)&&(currentCondition==="null"||currentCondition==="notNull"||currentCondition==="empty"||currentCondition==="notEmpty")){isExprAdded=true;exprs.push({fieldName:cols[i].key,cond:currentCondition,expr: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},_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==="bool"){result="true"}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;function getColumnTypeFromSchema(colKey,schemaFields){var schemaLoop;for(schemaLoop=0;schemaLoop<schemaFields.length;++schemaLoop){if(schemaFields[schemaLoop].name===colKey){return schemaFields[schemaLoop].type}}}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,condition:this._getDefaultCondition(cols[i].dataType),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,getColumnTypeFromSchema(cs[i].columnKey,this.grid.dataSource._schema.schema.fields));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($.ig.GridFiltering.locale.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){break}}if(j===settings.length){continue}conds=this._populateConditionsList(cs[i].columnKey,getColumnTypeFromSchema(cs[i].columnKey,this.grid.dataSource._schema.schema.fields));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($.ig.GridFiltering.locale.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};this.options.labels[keyCond]=this.options.labels[keyCond]||curCond.labelText;this.options.nullTexts[keyCond]=this.options.nullTexts[keyCond]||curCond.labelText;this._dsTransformedCustomConditions[keyCond]=newCond}}}}this.grid.dataSource.settings.filtering.customConditions=this._dsTransformedCustomConditions},_renderDropDown:function(type,id,colName){var ul=this._renderDropDownElement(id,colName),i,cs=this.options.columnSettings,cols=this.grid.options.columns,item,obj,conds;conds=this._populateConditionsList(colName,type);if(this.options.filterDropDownItemIcons!==true){$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).addClass(this.css.filterDropDownListItemClear)).text(this.options.labels.clear).addClass("ui-corner-all");for(i=0;i<conds.length;++i){$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond",conds[i].condition)).text(conds[i].text).addClass("ui-corner-all")}}else{obj={itemClass:this.css.filterDropDownListItemWithIcons,imgContainerClass:this.css.filterItemIconContainer,textClass:this.css.filterDropDownListItemTextContainer};this._renderDropDownToList(obj,[{text:this.options.labels.clear,imgClass:this.css.filterItemIconClear}],ul);this._renderDropDownToList(obj,conds,ul)}if(this.options.mode==="advanced"){this._renderAdvancedButton(ul)}for(i=0;i<cs.length;i++){if(cs[i].columnKey===colName&&cs[i].condition!==this._getDefaultCondition(cols[i].dataType)){if(cs[i].condition==="null"){item=ul.find(':contains("'+this.options.labels.nullLabel+'")')}else{item=ul.find(':contains("'+this.options.labels[cs[i].condition]+'")')}item=item.children().first().closest("li");item.addClass(this.css.filterDropDownListItemActive).parent().data("selectedItem",$("li",item.parent()).index(item))}}},_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.options.labels.advancedButtonLabel}).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.grid.container().attr("id")+"_dialog"),$container=this.grid.container();$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}}})},_openFilterDialog:function(event,columnKey){var maxZ,left,top,pos,h,w,bh,dh,dw,bw,noCancel=true,block=$("#"+this.grid.container().attr("id")+"_block"),dialog=$("#"+this.grid.container().attr("id")+"_dialog"),addDefault=true,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.container())}else{dialog.draggable("option","containment","document")}this._dialogCurrentColumn=$(event.target).closest("ul").data("colName");if(this._dialogCurrentColumn===undefined||this._dialogCurrentColumn===null){if(columnKey!==null&&columnKey!==undefined){this._dialogCurrentColumn=columnKey}else{this._dialogCurrentColumn=$(event.target).closest("th").data("colName")}}if(this._dialogCurrentColumn===undefined||this._dialogCurrentColumn===null){this._dialogCurrentColumn=this.grid.options.columns[0]}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()}}else{this._addFilterFromDialog()}noCancel=this._trigger(this.events.filterDialogOpening,null,{dialog:dialog,owner:this});if(noCancel){pos=$.ig.util.offset(this.grid.container());left=pos.left;top=pos.top;if(block.outerWidth()!==this.grid.container().outerWidth()){block.css("width",this.grid.container().outerWidth())}if(block.outerHeight()!==this.grid.container().outerHeight()){block.css("height",this.grid.container().outerHeight())}$("#"+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.container().outerWidth();h=this.grid.container().outerHeight();bw=$(window).width();bh=$(window).height();if(w+left>bw){w=w-(w+left-bw)}if(w<=0){w=this.grid.container().outerWidth()}if(h+top>bh){h=h-(h+top-bh)}if(h<=0){h=this.grid.container().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.css({left:left-rOffset.left,top:top-rOffset.top}).fadeToggle($.proxy(this._setResizableEnv,this));dialog.focus();event.preventDefault();event.stopPropagation();if(!(this.options.mode==="advanced"&&this.options.advancedModeEditorsVisible===false)&&this._currentTarget!==null&&this._currentTarget!==undefined){this._toggleDropDown({currentTarget:this._currentTarget},true)}}},_closeFilterDialog:function(e){var noCancel=true,$gridContainer=this.grid.container();noCancel=this._trigger(this.events.filterDialogClosing,null,{owner:this});if(noCancel){$gridContainer.unbind("keydown.focusChecker");$("#"+$gridContainer.attr("id")+"_block").fadeToggle();$("#"+$gridContainer.attr("id")+"_dialog").fadeToggle();this._trigger(this.events.filterDialogClosed,null,{owner:this});if(e){e.preventDefault();e.stopPropagation()}return false}},_searchFilterDialog:function(e){var expressions=[],rows,boolLogic,selectLogic,noCancel=true,i,type,exprObj,$row,expr,noCancelFiltering=true,cond,col,$input,hrs,mins,sec,ms;noCancel=this._trigger(this.events.filterDialogFiltering,null,{dialog:$("#"+this.grid.container().attr("id")+"_dialog"),owner:this});if(noCancel){rows=$("#"+this.grid.container().attr("id")+"_dialog").find("[data-af-row]");if(!rows.length){rows=$("#"+this.grid.container().attr("id")+"_dialog table tbody").children()}boolLogic="and";selectLogic=$("#"+this.grid.container().attr("id")+"_dialog select:first");if(selectLogic.length>0){boolLogic=$("#"+this.grid.container().attr("id")+"_dialog select:first")[0].value==="all"?"AND":"OR"}for(i=0;i<rows.length;i++){$row=$(rows[i]);$input=this._getDialogColSelByRow($row);if($input.data("value")!==undefined){col=this.grid.columnByKey($input.data("value"))}else{col=this.grid.columnByText($input[0].value)}if(!col){continue}type=col.dataType;expr=this._getDialogExprSelByRow($row).igGridFilterEditor("value");cond=this._getDialogCondSelByRow($row)[0].value;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(this.grid.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._closeFilterDialog(e);this._currentAdvancedExpressions=expressions;noCancelFiltering=this._trigger(this.events.dataFiltering,null,{owner:this,newExpressions:expressions});if(noCancelFiltering){this.filter(expressions,true,true)}}e.preventDefault();e.stopPropagation()},_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").igGridFilterEditor("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,okCancelContainer,f=this,caption,dialogContent,noCancel=true,addClearButtons,limit,container;container=this.grid._rootContainer();$("<div></div>").appendTo(container).attr("id",this.grid.container().attr("id")+"_block").css("position","absolute").addClass(this.css.blockArea).data("efh","1").hide();dialog=$("<div></div>").appendTo(container).attr("id",this.grid.container().attr("id")+"_dialog").css("position","absolute").css("width",this.options.filterDialogWidth).css("height",this.options.filterDialogHeight).addClass(this.css.filterDialog).data("efh","1").hide();noCancel=this._trigger(this.events.filterDialogContentsRendering,null,{dialogElement:dialog,owner:this});if(noCancel){caption=$("<div></div>").appendTo(dialog).addClass(this.css.filterDialogHeaderCaption);$("<span></span>").appendTo(caption).text(this.options.labels.filterDialogCaptionLabel).addClass(this.css.filterDialogHeaderCaptionTitle);$("<span></span>").appendTo($("<a></a>").appendTo(caption).attr({href:"#",role:"button",title:$.ig.GridFiltering.locale.filterDialogCloseLabel}).addClass("ui-dialog-titlebar-close ui-corner-all")).bind({click:$.proxy(this._closeFilterDialog,this)}).addClass("ui-icon ui-icon-closethick");dialogContent=$("<div></div>").appendTo(dialog).addClass("ui-dialog-content").css("overflow","auto");condObj={label1:this.options.labels.filterDialogConditionLabel1,label2:this.options.labels.filterDialogConditionLabel2};dropDownData=[{text:this.options.labels.filterDialogAllLabel,value:"all"},{text:this.options.labels.filterDialogAnyLabel,value:"any"}];if(this.options.filterDialogAddConditionTemplate&&typeof this.options.filterDialogAddConditionTemplate==="string"){condElement=$(this._fTmplWrappers[this.grid.id()+"_filterDialogAddConditionTemplate"](condObj))}else{condElement=$("<div><span>"+condObj.label1+"</span><div><select title='"+$.ig.GridFiltering.locale.filterDialogConditionDropDownLabel+"'></select></div><span>"+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))}else{condDropDown=$("<option value='"+dropDownData[0].value+"'>"+dropDownData[0].text+"</option>"+"<option value='"+dropDownData[1].value+"'>"+dropDownData[1].text+"</option>")}condDropDown.appendTo(condElement.find("div").addClass(this.css.filterDialogAddConditionDropDown).find("select"));addClearButtons=$("<div></div>").appendTo(dialogContent);$(toStaticHTML('<input type="button"></input>')).appendTo($("<span></span>").appendTo(addClearButtons).addClass(this.css.filterDialogAddButton)).igButton({labelText:this.options.labels.filterDialogAddLabel,width:this.options.filterDialogAddButtonWidth}).bind({click:$.proxy(this._addFilterFromDialog,this)});$("<button />").appendTo(addClearButtons).css("float","right").igButton({labelText:this.options.labels.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.options.labels.filterDialogErrorLabel).addClass("ui-widget ui-state-error ui-igvalidator-label");$("<table><tbody></tbody></table>").appendTo(dialogContent).addClass(this.css.filterDialogFiltersTable);okCancelContainer=$("<div></div>").appendTo($("<div></div>").appendTo(dialog).addClass(this.css.filterDialogOkCancelButton)).addClass("ui-dialog-buttonset");$('<button id="'+this.grid.element[0].id+'_filter_dialog_ok_button"/>').appendTo(okCancelContainer).igButton({labelText:this.options.labels.filterDialogOkLabel,width:this.options.filterDialogOkCancelButtonWidth}).bind({click:$.proxy(this._searchFilterDialog,this)});$('<button id="'+this.grid.element[0].id+'_filter_dialog_cancel_button"/>').appendTo(okCancelContainer).igButton({labelText:this.options.labels.filterDialogCancelLabel,width:this.options.filterDialogOkCancelButtonWidth}).bind({click:$.proxy(this._closeFilterDialog,this)});if(this._hc===true){limit=$("#"+this.grid.element[0].id.split("_")[0]+"_container")}else{limit=this.grid.container()}dialog.bind({keydown:function(e){var tabElems,first,last;if(e.keyCode===$.ui.keyCode.ESCAPE){f._closeFilterDialog()}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(1);return false}if(e.target===first[0]&&e.shiftKey){last.focus(1);return false}}}).draggable({containment:limit,handle:caption,drag:$.proxy(this._filterDialogMove,this)}).attr("role","dialog").attr("tabIndex",-1);if(typeof Modernizr!=="object"||Modernizr.touch===false){dialog.resizable({minHeight:dialog.outerHeight()/4,minWidth:dialog.outerWidth()/2,resize:$.proxy(this._resizeHandler,this)});if(this.options.filterDialogContainment==="owner"){dialog.resizable("option","containment","parent")}}this._trigger(this.events.filterDialogContentsRendered,null,{dialogElement:dialog,owner:this})}},_setResizableEnv:function(){var initH,e=$("#"+this.grid.container().attr("id")+"_dialog"),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.grid.container().attr("id")+"_dialog"),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=e.target.value;editor=this._getDialogExprSelByRow($row);this._setFilterDialogInput(editor,condition)
},_setFilterDialogInput:function(editor,condition){var requiresEntry,editorObject;requiresEntry=this._requiresEntry(condition);if(!requiresEntry){editor.igGridFilterEditor("option","disabled",true);editorObject=editor.data(editor.data("editorType"));this._editorValueForCondition(condition,editorObject)}else{editor.igGridFilterEditor("option","disabled",false)}},_getDialogColSelByRow:function($frow){var $elem=$frow.find("[data-af-col]");if(!$elem.length){$elem=$frow.find("td:first").find("input")}return $elem},_getDialogCondSelByRow:function($frow){var $elem=$frow.find("[data-af-cond]");if(!$elem.length){$elem=$frow.find("td:nth-child(2)").find("select")}return $elem},_getDialogExprSelByRow:function($frow){var $elem=$frow.find("[data-af-expr]");if(!$elem.length){$elem=$frow.find("td:nth-child(3)").find("input")}return $elem},_getDialogRmvBtnByRow:function($frow){var $elem=$frow.find("[data-af-rmv]");if(!$elem.length){$elem=$frow.find("td:last").find("span")}return $elem},_addFilterFromDialog:function(e,expression){var tableBody=$("#"+this.grid.container().attr("id")+"_dialog table tbody"),j,cs=this.options.columnSettings,rows,filterObj={},filterRow,colKeys,i,noCancel=true,field,type,cnd,allowed,defaultValue,condition,col,conds;noCancel=this._trigger(this.events.filterDialogFilterAdding,null,{filtersTableBody:tableBody,owner:this});if(noCancel){rows=$("#"+this.grid.container().attr("id")+"_dialog").find("[data-af-row]");if(!rows.length){rows=tableBody.children()}if(rows.length>=this.options.filterDialogMaxFilterCount){$("#"+this.grid.container().attr("id")+"_dialog_error").show();return}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><select data-af-cond title='"+$.ig.GridFiltering.locale.filterDialogConditionDropDownLabel+"'></select></td><td><input data-af-expr /> </td><td><span data-af-rmv></span></td></tr>")}filterRow.appendTo(tableBody);colKeys=[];for(i=0;i<this.grid.options.columns.length;i++){allowed=true;for(j=0;j<cs.length;j++){if((this.grid.options.columns[i].key===cs[j].columnKey||i===cs[j].columnIndex)&&cs[j].allowFiltering===false){allowed=false;break}}if(allowed){colKeys.push(this.grid.options.columns[i].headerText)}}if(expression===undefined){col=this.grid.columnByKey(this._dialogCurrentColumn);field=col.headerText;type=this._dialogCurrentType}else{col=this.grid.columnByKey(expression.fieldName);if(col!==null){field=col.headerText;type=col.dataType}condition=this._resolveConditionNameFromExpression(expression);defaultValue=expression.expr;if(type==="date"&&$.type(defaultValue)==="number"&&this.grid.options.enableUTCDates){defaultValue=new Date(defaultValue)}}cnd=this._getDialogCondSelByRow(filterRow);this._getDialogColSelByRow(filterRow).css("width",80).igTextEditor({listItems:colKeys,button:"dropdown",isLimitedToListValues:true,allowNullValue:false,buttonType:"dropdown",width:this.options.filterDialogColumnDropDownDefaultWidth||120,valueChanged:$.proxy(this._polulateFilterConditionDropDown,this),dropDownAttachedToBody:true,value:field});conds=this._populateConditionsList(col.key,type);this._renderAdvancedConditionsDropDown(cnd,conds);if(condition!==undefined&&cnd.length>0){cnd[0].value=condition}cnd.bind("change",$.proxy(this._changeFilterCondition,this));this._getDialogCondSelByRow(filterRow).css("width",this.options.filterDialogFilterDropDownDefaultWidth);this._populateFilterDialogInput(this._getDialogExprSelByRow(filterRow),type,defaultValue,col,condition);this._getDialogRmvBtnByRow(filterRow).addClass(this.css.filterDialogFilterRemoveButton).bind({mousedown:$.proxy(this._removeFilterFromDialog,this)});this._trigger(this.events.filterDialogFilterAdded,null,{filter:filterRow,owner:this})}},_filterDialogClearAll:function(e){var tableBody=$("#"+this.grid.container().attr("id")+"_dialog table tbody");tableBody.empty();$("#"+this.grid.container().attr("id")+"_dialog_error").hide();if(e){e.preventDefault()}},_polulateFilterConditionDropDown:function(e,args){var selectedColKey=args.newValue,conditionListElem,cols=this.grid.options.columns,type,input,i,col,conds,$tr,$target=$(e.target);$tr=$target.closest("[data-af-row]");if(!$tr.length){$tr=$target.closest("tr")}conditionListElem=this._getDialogCondSelByRow($tr);input=this._getDialogExprSelByRow($tr);if($(e.target).data("value")!==undefined){col=this.grid.columnByKey($(e.target).data("value"));if(col){type=col.dataType}}else{for(i=0;i<cols.length;i++){if(cols[i].headerText===selectedColKey){type=cols[i].dataType;col=cols[i];break}}}if(type===undefined){return}conds=this._populateConditionsList(col.key,type);this._renderAdvancedConditionsDropDown(conditionListElem,conds);this._populateFilterDialogInput(input,type,undefined,col,conds[0].condition)},_populateFilterDialogInput:function(input,type,defaultValue,col,condition){var edtrT=this._getEditorNameByColType(type),options={suppressNotifications:true,buttonHidden:type!=="date",button:"dropdown",disabled:type==="bool",maxDecimals:12,textAlign:type==="number"?"right":"left",width:this.options.filterDialogExprInputDefaultWidth,value:defaultValue,enableUTCDates:this.grid.options.enableUTCDates};if(type==="date"&&col&&col.format){options.dateInputFormat=col.format}if(!input.is("input")){input=input.find("INPUT").eq(0)}if(input.data("editorType")){input.igGridFilterEditor("destroy")}input.data("editorType",edtrT);input.igGridFilterEditor(options);if(condition){this._setFilterDialogInput(input,condition)}},_populateConditionsList:function(selectedColKey,type){var conditions=[],i,j,labels=this.options.labels,cs=this.options.columnSettings,css=this.css,validConditions=[],matchingCondition,custConds,curCond,newCond,key;if(type==="number"){validConditions.push({condition:"equals",text:labels.equals,imgClass:css.filterItemIconEquals});validConditions.push({condition:"doesNotEqual",text:labels.doesNotEqual,imgClass:css.filterItemIconDoesNotEqual});validConditions.push({condition:"greaterThan",text:labels.greaterThan,imgClass:css.filterItemIconGreaterThan});validConditions.push({condition:"lessThan",text:labels.lessThan,imgClass:css.filterItemIconLessThan});validConditions.push({condition:"greaterThanOrEqualTo",text:labels.greaterThanOrEqualTo,imgClass:css.filterItemIconGreaterThanOrEqualTo});validConditions.push({condition:"lessThanOrEqualTo",text:labels.lessThanOrEqualTo,imgClass:css.filterItemIconLessThanOrEqualTo})}else if(type==="bool"||type==="boolean"){validConditions.push({condition:"true",text:labels.trueLabel,imgClass:css.filterItemIconTrue});validConditions.push({condition:"false",text:labels.falseLabel,imgClass:css.filterItemIconFalse})}else if(type==="date"){validConditions.push({condition:"on",text:labels.on,imgClass:css.filterItemIconOn});validConditions.push({condition:"notOn",text:labels.notOn,imgClass:css.filterItemIconNotOn});validConditions.push({condition:"after",text:labels.after,imgClass:css.filterItemIconAfter});validConditions.push({condition:"before",text:labels.before,imgClass:css.filterItemIconBefore});validConditions.push({condition:"today",text:labels.today,imgClass:css.filterItemIconToday});validConditions.push({condition:"yesterday",text:labels.yesterday,imgClass:css.filterItemIconYesterday});validConditions.push({condition:"thisMonth",text:labels.thisMonth,imgClass:css.filterItemIconThisMonth});validConditions.push({condition:"lastMonth",text:labels.lastMonth,imgClass:css.filterItemIconLastMonth});validConditions.push({condition:"nextMonth",text:labels.nextMonth,imgClass:css.filterItemIconNextMonth});validConditions.push({condition:"thisYear",text:labels.thisYear,imgClass:css.filterItemIconThisYear});validConditions.push({condition:"lastYear",text:labels.lastYear,imgClass:css.filterItemIconLastYear});validConditions.push({condition:"nextYear",text:labels.nextYear,imgClass:css.filterItemIconNextYear})}else{validConditions.push({condition:"startsWith",text:labels.startsWith,imgClass:css.filterItemIconStartsWith});validConditions.push({condition:"endsWith",text:labels.endsWith,imgClass:css.filterItemIconEndsWith});validConditions.push({condition:"contains",text:labels.contains,imgClass:css.filterItemIconContains});validConditions.push({condition:"doesNotContain",text:labels.doesNotContain,imgClass:css.filterItemIconDoesNotContain});validConditions.push({condition:"equals",text:labels.equals,imgClass:css.filterItemIconEquals});validConditions.push({condition:"doesNotEqual",text:labels.doesNotEqual,imgClass:css.filterItemIconDoesNotEqual})}if(this.options.showEmptyConditions){validConditions.push({condition:"empty",text:labels.empty,imgClass:css.filterItemIcon});validConditions.push({condition:"notEmpty",text:labels.notEmpty,imgClass:css.filterItemIcon})}if(this.options.showNullConditions){validConditions.push({condition:"null",text:labels.nullLabel,imgClass:css.filterItemIcon});validConditions.push({condition:"notNull",text:labels.notNull,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){if(cs.conditionList.length===0){throw new Error($.ig.GridFiltering.locale.conditionListLengthCannotBeZero)}for(i=0;i<cs.conditionList.length;++i){matchingCondition=null;for(j=0;j<validConditions.length;++j){if(validConditions[j].condition===cs.conditionList[i]){matchingCondition=validConditions[j];break}}if(!matchingCondition){throw new Error($.ig.util.stringFormat($.ig.GridFiltering.locale.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){var i,condList="";conditionListElem.empty();if(this.options.filterDialogFilterConditionTemplate&&typeof this.options.filterDialogFilterConditionTemplate==="string"){condList=$(this._fTmplWrappers[this.grid.id()+"_filterDialogFilterConditionTemplate"](conditions))}else{for(i=0;i<conditions.length;i++){condList+="<option value='"+conditions[i].condition+"'>"+conditions[i].text+"</option>"}condList=$(condList)}condList.appendTo(conditionListElem);if($.ig.util.isIE){conditionListElem.parent().append(conditionListElem);conditionListElem.width(conditionListElem.width())}},_removeFilterFromDialog:function(e){var filterR,$target=$(e.target),$tr=$target.closest("[data-af-row]");if(!$tr.length){$target.closest("tr").remove();filterR=$("#"+this.grid.container().attr("id")+"_dialog").find("tr")}else{$tr.remove();filterR=$("#"+this.grid.container().attr("id")+"_dialog").find("[data-af-row]")}if(filterR.length<this.options.filterDialogMaxFilterCount){$("#"+this.grid.container().attr("id")+"_dialog_error").hide()}},_renderDropDownToList:function(obj,list,ul){var i,cond;for(i=0;i<list.length;i++){cond=$("<li class='"+obj.itemClass+"'><span class='"+obj.imgContainerClass+"'>"+"<span class='"+this.css.filterItemIcon+" "+list[i].imgClass+"'></span></span>"+"<span class='"+obj.textClass+"'> "+list[i].text+"</span></li>");cond.appendTo(ul).data("cond",list[i].condition)}},_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).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");$("#"+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");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");target.removeClass(this.css.filterButtonAdvancedActive);target.removeClass(this.css.filterButtonActive)},_toggleDropDown:function(event,close,dontFocus){var $target=$(event.currentTarget),id=$target.attr("id"),dd,left,top,noCancel=true,button=$target.find("span"),rOffset,maxZ,block=$("#"+this.grid.container().attr("id")+"_block"),dialog=$("#"+this.grid.container().attr("id")+"_dialog");if(this._animating&&id===this._animatingId){return}maxZ=$.ig.getMaxZIndex(this.grid.container().attr("id")+"_dialog");block.css("zIndex",maxZ+1);dialog.css("zIndex",maxZ+2);dd=$("#"+id.substring(0,id.lastIndexOf("_button")));dd.css("zIndex",maxZ+3);if(!(!dd.is(":visible")&&close===true)){this._animating=true;this._animatingId=id}if(this._openingAnimation!==true){this._dontFocus=dontFocus}else{this._dontFocus=null}this._isClosing=false;if(dd.is(":visible")){noCancel=this._trigger(this.events.dropDownClosing,null,{dropDown:dd,owner:this});this._isClosing=true}else{if(!close){noCancel=this._trigger(this.events.dropDownOpening,null,{dropDown:dd,owner:this})}}if(noCancel){left=$.ig.util.offset(button).left;top=$.ig.util.offset(button).top+button.outerHeight();if(dd.offset().left!==left&&dd.offset().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._closingTarget=this._currentTarget}else{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})}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}if(this._dd&&$.ig.util.isIE){this._dd.css("overflow-y","auto")}this._isClosing=null;if(this._dontFocus!==true){this._dontApplyStyles=true;this._openingTarget.focus()}this._animating=false},_toggleDropDownKeyboard:function(event){var parent,selectedItem,$target=$(event.target),ddVisible;if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){event.stopPropagation();event.preventDefault();parent=$("#"+$target.attr("id").substring(0,$target.attr("id").lastIndexOf("_button"))).find("ul");if(parent.data("selectedItem")||parent.data("selectedItem")===0){selectedItem=parent.find("li:nth-child("+(parent.data("selectedItem")+1)+")");ddVisible=$("#"+$target.attr("id").substring(0,$target.attr("id").lastIndexOf("_button"))).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.stopPropagation();event.preventDefault();this._selectDropDownItem(event,"next")}else if(event.keyCode===$.ui.keyCode.UP){event.stopPropagation();event.preventDefault();this._selectDropDownItem(event,"prev")}},_closeDropDown:function(event){var $target=$(event.currentTarget).find("span"),$targetButton=$(event.currentTarget),dd;if(this._openingTarget&&event.target.id===this._openingTarget.attr("id")&&this._openingAnimation===true){return}dd=$("#"+$targetButton.attr("id").substring(0,$targetButton.attr("id").lastIndexOf("_button")));if(dd&&!dd.is(":visible")){$target.removeClass(this.css.filterButtonActive);return}this._toggleDropDown(event,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)}},_selectDropDownItem:function(event,nav,expr){var $target=$(event.currentTarget),filterCondition,colIndex,sel,parent,requiresEntry,button,currentCond,targetParent,evtArgs;if($target.find("input").length>0&&this.options.mode==="advanced"){return}if(nav==="next"||nav==="prev"){parent=$("#"+$target.attr("id").substring(0,$target.attr("id").lastIndexOf("_button"))).find("ul")}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.data("cond");button=$("#"+$target.closest("div").attr("id")+"_button");button.attr("title",this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter));if($target.data("cond")===undefined){button.attr("title",this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter))}colIndex=$("#"+$target.closest("div").attr("id")+"_button").find("span").data("colIndex");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");requiresEntry=this._requiresEntry(filterCondition);if(filterCondition!==undefined){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._editors[colIndex].element.igGridFilterEditor("option","placeHolder",this.options.nullTexts[filterCondition])}else if(currentCond==="empty"||currentCond==="notEmpty"||currentCond==="null"||currentCond==="notNull"||!this._requiresEntry(currentCond)){this.options.columnSettings[parseInt(colIndex,10)].condition=this._getDefaultCondition(this.grid.options.columns[colIndex].dataType);if(sel!==undefined){targetParent.find("li:nth-child("+(sel+1)+")").removeClass(this.css.filterDropDownListItemActive);targetParent.data("selectedItem",null);if(this.grid.options.columns[colIndex].dataType!=="bool"){this._editors[colIndex].element.igGridFilterEditor("option","placeHolder",this._getDefaultCondition(this.grid.options.columns[colIndex].dataType))}else{this._editors[colIndex].element.igGridFilterEditor("option","placeHolder",this.options.nullTexts[this._getDefaultCondition(this.grid.options.columns[colIndex].dataType)])}}if(currentCond==="null"||this.grid.options.columns[colIndex].dataType==="date"){this._editors[colIndex].element.igGridFilterEditor("option","placeHolder",this.options.nullTexts[this._getDefaultCondition(this.grid.options.columns[colIndex].dataType)])}}else{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))}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){this._editors[colIndex].element.igGridFilterEditor("option","disabled",this.grid.options.columns[colIndex].dataType==="bool")}this._editors[colIndex].value(null);this._filterDataSourceClear(this.grid.options.columns[colIndex].key,colIndex);this._toggleDropDown({currentTarget:button},true)}else{if(!requiresEntry&&!expr){this._editors[colIndex].element.igGridFilterEditor("option","disabled",true);this._editors[colIndex].editorContainer().removeClass("ui-state-disabled");this._editorValueForCondition(filterCondition,this._editors[colIndex]);this._args=undefined;this._filterInternal(colIndex,this.grid.options.columns[colIndex].key)}else if(this._editors[colIndex].value()!==""&&this._editors[colIndex].value()!==null){this._editors[colIndex].setFocus(true);evtArgs={owner:this._editors[colIndex],text:this._editors[colIndex].displayValue()};this._filter(event,evtArgs)}if(requiresEntry){this._editors[colIndex].element.igGridFilterEditor("option","disabled",false);if(nav===undefined&&filterCondition!==undefined){this._editors[colIndex].setFocus()}}}}},_requiresEntry:function(filterCondition){var custConds=this._dsTransformedCustomConditions;if(filterCondition==="true"||filterCondition==="false"||filterCondition==="today"||filterCondition==="yesterday"||filterCondition==="thisMonth"||filterCondition==="nextMonth"||filterCondition==="lastMonth"||filterCondition==="thisYear"||filterCondition==="lastYear"||filterCondition==="empty"||filterCondition==="notEmpty"||filterCondition==="null"||filterCondition==="notNull"||filterCondition==="nextYear"){return false}if(custConds&&custConds[filterCondition]){return custConds[filterCondition].requireExpr}if(filterCondition===undefined||filterCondition===null){return false}return true},_editorValueForCondition:function(filterCondition,editor){var date=new Date,custConds=this._dsTransformedCustomConditions;if(filterCondition==="true"){editor.value(true)}else if(filterCondition==="false"){editor.value(false)}else if(filterCondition==="today"){editor.value(new Date)}else if(filterCondition==="yesterday"){if(this.grid.options.enableUTCDates){editor.value(new Date(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate()-1,0,0,0,0)))}else{editor.value(new Date(date.getFullYear(),date.getMonth(),date.getDate()-1,0,0,0,0))}}else if(custConds&&custConds[filterCondition]){editor.value(custConds[filterCondition].expressionText)}else{editor.value(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("id",this.grid.element[0].id+"_dd_"+columnKey+"_button")}this._updateTooltips(this._currentAdvancedExpressions||[])}else{throw new Error($.ig.GridFiltering.locale.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($.ig.GridFiltering.locale.virtualizationSimpleFilteringNotAllowed)}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.grid.element.igGridFeatureChooser!==undefined){this.grid.element.igGridFeatureChooser()}else{throw new Error($.ig.GridFiltering.locale.featureChooserNotReferenced)}this._assignTemplates();if(this.options.persist){this._preserveFiltering()}}});$.extend($.ui.igGridFiltering,{version:"15.2.20152.1027"});$.fn.extend({igGridFilterEditor:function(){var edtrT=this.data("editorType"),func=this[edtrT];if($.type(func)!=="function"){return}return func.apply(this,arguments)}})})(jQuery);