/*!@license
 * Infragistics.Web.ClientUI Grid Sorting 14.1.20141.1020
 *
 * Copyright (c) 2011-2014 Infragistics Inc.
 *
 * http://www.infragistics.com/
 *
 * Depends on:
 *	jquery-1.4.4.js
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery-tmpl.js (https://github.com/jquery/jquery-tmpl)
 *	infragistics.ui.grid.framework.js
 *	infragistics.ui.editors.js
 *	infragistics.ui.shared.js
 *	infragistics.dataSource.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,defaultExpressions:[]}],type:null,filterDelay:500,mode:null,advancedModeEditorsVisible:false,advancedModeHeaderButtonLocation:"left",filterDialogWidth:370,filterDialogMaxHeight:350,filterDialogHeight:"",filterDialogFilterDropDownDefaultWidth:80,filterDialogExprInputDefaultWidth:80,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},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},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(options,element){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;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+" "+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,cols=this.grid.options.columns,block=$("#"+this.grid.id()+"_container_block"),dialog=$("#"+this.grid.id()+"_container_dialog");$("#"+this.grid.container()[0].id+" .ui-iggrid-filterrow").remove();$("#"+this.grid.container()[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();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}if(this._exitEditModeHandler){delete this._exitEditModeHandler}if(this._enterEditModeHandler){delete this._enterEditModeHandler}$.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){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.igEditor("option","nullText",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=[]},_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;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){this._shouldFireDataFiltered=false;this._trigger(this.events.dataFiltered,null,{columnKey:this._curColKey,columnIndex:this._curColIndex,owner:this})}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");summary.attr("id",this.grid.element[0].id+"_pager_label")}shouldInitHeights=true}if(this.options.type==="local"||this.options.type==="remote"&&this.grid.dataSource.hasTotalRecordsCount()===false){if(this.grid.dataSource._filter){matches=this.grid.dataSource._filteredData.length}else{matches=this.grid.dataSource._data.length}}else{matches=this.grid.dataSource.totalRecordsCount()}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();this._isFilteringRequest=false}else if(this._isFilteringRequest===false){expr=this.grid.dataSource.settings.filtering.expressions||[];if(summary.data("hideflag")!==false&&expr.length===0){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(grid.options.virtualization||grid.options.rowVirtualization){if(!shouldInitHeights){this.grid._initializeHeights()}if(grid._totalRowCount*grid._avgRowHeight<=parseInt(grid.options.height,10)){grid.element.height("");grid._avgRowHeight=grid._calculateAvgRowHeight();grid._setScrollContainerHeight(grid._totalRowCount*grid._avgRowHeight)}}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){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").first().igEditor("option","width",cellWidth)}},_headerRendered:function(sender,args){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].dataType,cols[i].key)}}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(event,ui){if(this._isInitFC!==true){this._initFC()}},_openFilterDialogFromFC:function(event,columnKey){this._openFilterDialog(event,columnKey)},toggleFilterRowByFeatureChooser:function(event,columnKey){var fc,o=this.options,isShown=this._filterRowShown,$thead=this.grid.container().find("thead"),$filterRow,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){fc=this.grid.element.data("igGridFeatureChooser");if(fc){fc._toggleSelectedItems("Filtering")}}this._filterRowShown=isShown;this.grid._initializeHeights();this.grid._adjustLastColumnWidth(true)}},_createEditor:function(parent,w,colIndex,colType,colKey){var editor,options,type=this._getEditorType(colType);editor=$("<span />").css("float","left").css("width","5px");if(this.options.filterButtonLocation==="left"){editor.appendTo(parent)}else{editor.prependTo(parent)}if(this._enterEditModeHandler===undefined||this._enterEditModeHandler===null){this._enterEditModeHandler=$.proxy(this._fireEnterEditModeEvents,this)}if(this._exitEditModeHandler===undefined||this._exitEditModeHandler===null){this._exitEditModeHandler=$.proxy(this._fireExitEditModeEvents,this)}options={textChanged:$.proxy(this._filter,this),width:w,disabled:this.grid.options.columns[colIndex].dataType==="bool"||this.grid.options.columns[colIndex].dataType==="boolean",type:type,textAlign:"left",button:type==="datepicker"?"dropdown":null,maxDecimals:6,nullText:this.options.nullTexts[this._findColumnSetting(colKey).condition],focus:this._enterEditModeHandler,blur:this._exitEditModeHandler,enableUTCDates:this.grid.options.enableUTCDates};editor.data("colIndex",colIndex).data("colKey",colKey);editor.igEditor(options);this._editors.push(editor.data("igEditor"));editor.find("input").addClass(this.css.filterCellEditor)},_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)}},_getEditorType:function(type){return type==="date"?"datepicker":type==="number"?"numeric":"text"},_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)}},_fireEnterEditModeEvents:function(evt,ui){var sel=ui&&ui.owner?ui.owner._grid_sel:null;if(sel){if(sel.time+1e3>(new Date).getTime()){ui.owner.select(sel.sel)}this.grid._synchronizeHScroll();delete ui.owner._grid_sel}},_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,expressions:exprs});if(noCancel){this.grid._isToSetUnboundColumns=true;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);if(editor){editor._grid_sel={time:(new Date).getTime(),sel:editor._sel0};editor.setFocus()}}},_filterDataSource:function(expressions,apiCall,updateUI){var exprs,i,j,button,groupBy,cols=this.grid.options.columns,found=false,defaultTooltip,noCancel;defaultTooltip=this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter);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}",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});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})}}}}},_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()}this.grid.element.trigger("iggriduidirty",{owner:this});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,expressions:exprs});if(noCancelFiltering){noCancel=this.grid._trigger(this.grid.events.dataBinding,null,{owner:this.grid});if(noCancel){this.grid.dataSource.settings.paging.pageIndex=0;this._preserveSorting();this.grid._shouldResetPaging=true;this.grid._isToSetUnboundColumns=true;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})}}}},_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,addedFromAdvanced){var i,j,editor,filterList,items;if(this._editors){for(i=0;i<this._editors.length;i++){if(this.options.columnSettings[i].allowFiltering!==false){this._editors[i].value(null)}}}for(i=0;i<expressions.length;i++){filterList=$("#"+this.grid.element[0].id+"_dd_"+expressions[i].fieldName).find("ul");items=filterList.children();for(j=0;j<items.length;j++){if($(items[j]).data("cond")===expressions[i].cond){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,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}}if(isSimpleMode){button.attr("title",this.options.tooltipTemplate.replace("${condition}",expressions[i].cond));continue}if(i===0){button.attr("title",expressionFieldName+" "+expressions[i].cond+" "+tempTooltipExpr+" ")}else{button.attr("title",title+expressions[i].logic+" "+expressionFieldName+" "+expressions[i].cond+" "+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)}}},_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;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){continue}expr=this._editors[i].value();requiresEntry=this._requiresEntry(this.options.columnSettings[i].condition);if((expr===undefined||expr===null||expr==="")&&requiresEntry){continue}currentCondition=this.options.columnSettings[i].condition;if(currentCondition===undefined||currentCondition===null||currentCondition===""){continue}dt=cols[i].dataType;if(dt==="date"&&expr){if(this.options.type==="remote"){expr=Date.UTC(expr.getUTCFullYear(),expr.getUTCMonth(),expr.getUTCDate(),expr.getUTCHours(),expr.getUTCMinutes())}else if(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(this.options.columnSettings[i].condition)){if(expr!==""&&!this.options.filterExprUrlKey){isExprAdded=true;exprs.push({fieldName:cols[i].key,cond:currentCondition,expr:expr})}else if(dt==="bool"&&expr!==""||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===""&&(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}}}}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,cols=this.grid.options.columns,allowFiltering,defExpr,isToCheckUnboundColumns=this.grid._hasUnboundColumns===true&&this.options.type==="remote";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}}}for(i=0;i<cs.length;i++){for(j=0;j<settings.length;j++){if(settings[j].columnKey===cs[i].columnKey||settings[j].columnIndex===cs[i].columnIndex){break}}if(j===settings.length){continue}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];for(k=0;k<defExpr.length;k++){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},_renderDropDown:function(type,id,colName){var ul,i,cs=this.options.columnSettings,cols=this.grid.options.columns,item,obj,conds=[],cond;if(type==="number"){ul=this._renderNumericFilterDropDown(id,colName)}else if(type==="date"){ul=this._renderDateFilterDropDown(id,colName)}else if(type==="boolean"||type==="bool"){ul=this._renderBooleanFilterDropDown(id,colName)}else{ul=this._renderStringFilterDropDown(id,colName)}if(this.options.filterDropDownItemIcons!==true){if(this.options.showEmptyConditions){$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","empty")).text(this.options.labels.empty).addClass("ui-corner-all");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","notEmpty")).text(this.options.labels.notEmpty).addClass("ui-corner-all")}if(this.options.showNullConditions){$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","null")).text(this.options.labels.nullLabel).addClass("ui-corner-all");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","notNull")).text(this.options.labels.notNull).addClass("ui-corner-all")}}else{obj={itemClass:this.css.filterDropDownListItemWithIcons,imgContainerClass:this.css.filterItemIconContainer,textClass:this.css.filterDropDownListItemTextContainer};if(this.options.showEmptyConditions){conds.push({text:this.options.labels.empty,imgClass:this.css.filterItemIcon,condition:"empty"});conds.push({text:this.options.labels.notEmpty,imgClass:this.css.filterItemIcon,condition:"notEmpty"})}if(this.options.showNullConditions){conds.push({text:this.options.labels.nullLabel,imgClass:this.css.filterItemIcon,condition:"null"});conds.push({text:this.options.labels.notNull,imgClass:this.css.filterItemIcon,condition:"notNull"})}for(i=0;i<conds.length;i++){cond=$("<li class='"+obj.itemClass+"'><span class='"+obj.imgContainerClass+"'>"+"<span class='"+this.css.filterItemIcon+" "+conds[i].imgClass+"'></span></span>"+"<span class='"+obj.textClass+"'> "+conds[i].text+"</span></li>");cond.appendTo(ul).data("cond",conds[i].condition)}}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)}},_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"),i,addDefault=true,rOffset,expressions=this.grid.dataSource.settings.filtering.expressions;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","window")}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));this._trigger(this.events.filterDialogOpened,null,{dialog:dialog,owner: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;noCancel=this._trigger(this.events.filterDialogClosing,null,{owner:this});if(noCancel){$("#"+this.grid.container().attr("id")+"_block").fadeToggle();$("#"+this.grid.container().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,expr,noCancelFiltering=true,cond;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 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++){type=this.grid.columnByText($(rows[i].cells[0]).find("input")[0].value).dataType;expr=$(rows[i].cells[2]).find("input").igEditor("value");if(expr&&(expr.nodeName||expr[0]&&expr[0].nodeName)){expr=$(rows[i].cells[2]).find("span").igEditor("value")}cond=$(rows[i].cells[1]).find("select")[0].value;if($.type(expr)==="date"){if(this.grid.options.enableUTCDates){expr=Date.UTC(expr.getUTCFullYear(),expr.getUTCMonth(),expr.getUTCDate(),expr.getUTCHours(),expr.getUTCMinutes())}if(cond==="after"&&this.options.type==="local"){expr.setHours(23);expr.setMinutes(59);expr.setSeconds(59);expr.setMilliseconds(999)}}expressions.push({fieldName:this.grid.columnByText($(rows[i].cells[0]).find("input")[0].value).key,cond:cond,expr:expr,logic:boolLogic,type:type});if(type===undefined&&$.type(expr)==="string"){expressions[expressions.length-1].dataType="string"}}this._closeFilterDialog(e);this._currentAdvancedExpressions=expressions;noCancelFiltering=this._trigger(this.events.dataFiltering,null,{owner:this,expressions:expressions});if(noCancelFiltering){this.filter(expressions,true,true)}}e.preventDefault();e.stopPropagation()},_filterDialogStartMove:function(e){this._isFilterDialogMouseDown=true},_filterDialogStopMove:function(e){this._isFilterDialogMouseDown=false;this._dialogClientX=undefined;this._dialogClientY=undefined},_filterDialogMove:function(e,ui){$(e.target).find(".ui-igedit-fieldincontainer").igEditor("dropDownVisible",false);if(ui.position.top<0){ui.position.top=this.grid.container().position().top}this._trigger(this.events.filterDialogMoving,null,{dialog:e.target,owner:this})},_renderFilterDialog:function(){var dialog,condObj,dropDownData,condElement,condDropDown,okCancelContainer,f=this,caption,dialogContent,noCancel=true,addClearButtons,limit;$("<div></div>").appendTo(this.grid._rootContainer()).attr("id",this.grid.container().attr("id")+"_block").css("position","absolute").addClass(this.css.blockArea).data("efh","1").hide();dialog=$("<div></div>").appendTo(this.grid._rootContainer()).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","#").attr("role","button").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").css("height",this.options.filterDialogMaxHeight);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></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({mousedown:$.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({mousedown:$.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){if(e.keyCode===$.ui.keyCode.ESCAPE){f._closeFilterDialog()}}}).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,containment:"parent",resize:$.proxy(this._resizeHandler,this)})}this._trigger(this.events.filterDialogContentsRendered,null,{dialogElement:dialog,owner:this})}},_setResizableEnv:function(){var 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();this._resizeCont=rCont;this._heightDifference=hCont.outerHeight(true)+bCont.outerHeight(true)+pad},_resizeHandler:function(event,ui){var u=ui.originalElement;this._resizeCont.css({height:u.height()-this._heightDifference+"px"})},_changeFilterCondition:function(e){var requiresEntry,editor,condition,editorObject;condition=e.target.value;editor=$(e.target).closest("td").parent().find("td:nth-child(3)").find("input");requiresEntry=this._requiresEntry(condition);if(!requiresEntry){editor.igEditor("option","disabled",true);editorObject=editor.data("igEditor");this._editorValueForCondition(condition,editorObject)}else{editor.igEditor("option","disabled",false)}},_addFilterFromDialog:function(e,expression){var tableBody=$("#"+this.grid.container().attr("id")+"_dialog table tbody"),j,cs=this.options.columnSettings,filterObj={},filterRow,colKeys,i,noCancel=true,field,type,cnd,allowed,defaultValue,condition,col;noCancel=this._trigger(this.events.filterDialogFilterAdding,null,{filtersTableBody:tableBody,owner:this});if(noCancel){if(tableBody.children().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><td><input/></td><td><select></select></td><td><input /> </td><td><span></span></td></tr>")}filterRow.appendTo(tableBody).hide();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){field=this.grid.columnByKey(this._dialogCurrentColumn).headerText;type=this._dialogCurrentType}else{col=this.grid.columnByKey(expression.fieldName);if(col!==null){field=col.headerText;type=col.dataType}condition=expression.cond;defaultValue=expression.expr;if(type==="date"&&$.type(defaultValue)==="number"&&this.grid.options.enableUTCDates){defaultValue=new Date(defaultValue)}}filterRow.find("td:first").find("input").css("width",80).igEditor({listItems:colKeys,button:"dropdown",listAutoComplete:true,listMatchOnly:true,width:this.options.filterDialogColumnDropDownDefaultWidth||120,textChanged:$.proxy(this._polulateFilterConditionDropDown,this),value:field,enableUTCDates:this.grid.options.enableUTCDates});cnd=filterRow.find("td:nth-child(2)").children().first();this._populateConditionsList(cnd,field,type);if(condition!==undefined&&cnd.length>0){cnd[0].value=condition}cnd.bind("change",$.proxy(this._changeFilterCondition,this));filterRow.find("td:nth-child(2)").children().first().css("width",this.options.filterDialogFilterDropDownDefaultWidth);filterRow.show();this._populateFilterDialogInput(filterRow.find("td:nth-child(3)").children().first(),type,defaultValue);filterRow.find("td:last").children().first().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()},_polulateFilterConditionDropDown:function(e){var selectedColKey=e.target.value,conditionList,cols=this.grid.options.columns,type,expr,i;conditionList=$(e.target).closest("tr").find("td:nth-child(2)").children().first();expr=$(e.target).closest("tr").find("td:nth-child(3)").children().first();for(i=0;i<cols.length;i++){if(cols[i].headerText===selectedColKey){type=cols[i].dataType;break}}if(type===undefined){return}this._populateConditionsList(conditionList,selectedColKey,type);this._populateFilterDialogInput(expr,type)},_populateFilterDialogInput:function(input,type,defaultValue){var options={type:this._getEditorType(type),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(!input.is("input")){input=input.find("INPUT")}input.igEditor(options)},_populateConditionsList:function(conditionList,selectedColKey,type){var conditions=[],condList="",i;if(type==="number"){conditions.push({conditionName:"equals",conditionLabel:this.options.labels.equals});conditions.push({conditionName:"doesNotEqual",conditionLabel:this.options.labels.doesNotEqual});conditions.push({conditionName:"greaterThan",conditionLabel:this.options.labels.greaterThan});conditions.push({conditionName:"lessThan",conditionLabel:this.options.labels.lessThan});conditions.push({conditionName:"greaterThanOrEqualTo",conditionLabel:this.options.labels.greaterThanOrEqualTo});conditions.push({conditionName:"lessThanOrEqualTo",conditionLabel:this.options.labels.lessThanOrEqualTo})}else if(type==="bool"||type==="boolean"){conditions.push({conditionName:"true",conditionLabel:this.options.labels.trueLabel});conditions.push({conditionName:"false",conditionLabel:this.options.labels.falseLabel})}else if(type==="date"){conditions.push({conditionName:"on",conditionLabel:this.options.labels.on});conditions.push({conditionName:"notOn",conditionLabel:this.options.labels.notOn});conditions.push({conditionName:"after",conditionLabel:this.options.labels.after});conditions.push({conditionName:"before",conditionLabel:this.options.labels.before});conditions.push({conditionName:"today",conditionLabel:this.options.labels.today});conditions.push({conditionName:"yesterday",conditionLabel:this.options.labels.yesterday});conditions.push({conditionName:"thisMonth",conditionLabel:this.options.labels.thisMonth});conditions.push({conditionName:"lastMonth",conditionLabel:this.options.labels.lastMonth});conditions.push({conditionName:"nextMonth",conditionLabel:this.options.labels.nextMonth});conditions.push({conditionName:"thisYear",conditionLabel:this.options.labels.thisYear});conditions.push({conditionName:"lastYear",conditionLabel:this.options.labels.lastYear});conditions.push({conditionName:"nextYear",conditionLabel:this.options.labels.nextYear})}else{conditions.push({conditionName:"startsWith",conditionLabel:this.options.labels.startsWith});conditions.push({conditionName:"endsWith",conditionLabel:this.options.labels.endsWith});conditions.push({conditionName:"contains",conditionLabel:this.options.labels.contains});conditions.push({conditionName:"doesNotContain",conditionLabel:this.options.labels.doesNotContain});conditions.push({conditionName:"equals",conditionLabel:this.options.labels.equals});conditions.push({conditionName:"doesNotEqual",conditionLabel:this.options.labels.doesNotEqual})}if(this.options.showEmptyConditions){conditions.push({conditionName:"empty",conditionLabel:this.options.labels.empty});conditions.push({conditionName:"notEmpty",conditionLabel:this.options.labels.notEmpty})}if(this.options.showNullConditions){conditions.push({conditionName:"null",conditionLabel:this.options.labels.nullLabel});conditions.push({conditionName:"notNull",conditionLabel:this.options.labels.notNull})}conditionList.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].conditionName+"'>"+conditions[i].conditionLabel+"</option>"}condList=$(condList)}condList.appendTo(conditionList);if($.ig.util.isIE){conditionList.parent().append(conditionList);conditionList.width(conditionList.width())}},_removeFilterFromDialog:function(e){var tableBody=$("#"+this.grid.container().attr("id")+"_dialog table tbody");$(e.target).closest("tr").remove();if(tableBody.children().length<this.options.filterDialogMaxFilterCount){$("#"+this.grid.container().attr("id")+"_dialog_error").hide()}},_renderStringFilterDropDown:function(id,colName){var ul=this._renderDropDownElement(id,colName),obj,conds=[],cond;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");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","startsWith")).text(this.options.labels.startsWith).addClass("ui-corner-all");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","endsWith")).text(this.options.labels.endsWith).addClass("ui-corner-all");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","contains")).text(this.options.labels.contains).addClass("ui-corner-all");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","doesNotContain")).text(this.options.labels.doesNotContain).addClass("ui-corner-all");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","equals")).text(this.options.labels.equals).addClass("ui-corner-all");$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","doesNotEqual")).text(this.options.labels.doesNotEqual).addClass("ui-corner-all")}else{obj={itemClass:this.css.filterDropDownListItemWithIcons,imgContainerClass:this.css.filterItemIconContainer,textClass:this.css.filterDropDownListItemTextContainer};conds.push({text:this.options.labels.clear,imgClass:this.css.filterItemIconClear});conds.push({text:this.options.labels.startsWith,imgClass:this.css.filterItemIconStartsWith,condition:"startsWith"});conds.push({text:this.options.labels.endsWith,imgClass:this.css.filterItemIconEndsWith,condition:"endsWith"});conds.push({text:this.options.labels.contains,imgClass:this.css.filterItemIconContains,condition:"contains"});conds.push({text:this.options.labels.doesNotContain,imgClass:this.css.filterItemIconDoesNotContain,condition:"doesNotContain"});conds.push({text:this.options.labels.equals,imgClass:this.css.filterItemIconEquals,condition:"equals"});conds.push({text:this.options.labels.doesNotEqual,imgClass:this.css.filterItemIconDoesNotEqual,condition:"doesNotEqual"});this._renderDropDownToList(obj,conds,ul)}return ul},_renderNumericFilterDropDown:function(id,colName){var ul=this._renderDropDownElement(id,colName),obj,conds=[],cond;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);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","equals")).text(this.options.labels.equals);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","doesNotEqual")).text(this.options.labels.doesNotEqual);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","greaterThan")).text(this.options.labels.greaterThan);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","lessThan")).text(this.options.labels.lessThan);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","greaterThanOrEqualTo")).text(this.options.labels.greaterThanOrEqualTo);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","lessThanOrEqualTo")).text(this.options.labels.lessThanOrEqualTo)}else{obj={itemClass:this.css.filterDropDownListItemWithIcons,imgContainerClass:this.css.filterItemIconContainer,textClass:this.css.filterDropDownListItemTextContainer};conds.push({text:this.options.labels.clear,imgClass:this.css.filterItemIconClear});conds.push({text:this.options.labels.equals,imgClass:this.css.filterItemIconEquals,condition:"equals"});conds.push({text:this.options.labels.doesNotEqual,imgClass:this.css.filterItemIconDoesNotEqual,condition:"doesNotEqual"});conds.push({text:this.options.labels.greaterThan,imgClass:this.css.filterItemIconGreaterThan,condition:"greaterThan"});conds.push({text:this.options.labels.lessThan,imgClass:this.css.filterItemIconLessThan,condition:"lessThan"});conds.push({text:this.options.labels.greaterThanOrEqualTo,imgClass:this.css.filterItemIconGreaterThanOrEqualTo,condition:"greaterThanOrEqualTo"});conds.push({text:this.options.labels.lessThanOrEqualTo,imgClass:this.css.filterItemIconLessThanOrEqualTo,condition:"lessThanOrEqualTo"});this._renderDropDownToList(obj,conds,ul)}return ul},_renderDateFilterDropDown:function(id,colName){var ul=this._renderDropDownElement(id,colName),obj,conds=[],cond;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);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","on")).text(this.options.labels.on);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","notOn")).text(this.options.labels.notOn);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","after")).text(this.options.labels.after);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","before")).text(this.options.labels.before);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","today")).text(this.options.labels.today);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","yesterday")).text(this.options.labels.yesterday);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","thisMonth")).text(this.options.labels.thisMonth);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","lastMonth")).text(this.options.labels.lastMonth);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","nextMonth")).text(this.options.labels.nextMonth);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","thisYear")).text(this.options.labels.thisYear);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","lastYear")).text(this.options.labels.lastYear);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","nextYear")).text(this.options.labels.nextYear)}else{obj={itemClass:this.css.filterDropDownListItemWithIcons,imgContainerClass:this.css.filterItemIconContainer,textClass:this.css.filterDropDownListItemTextContainer};conds.push({text:this.options.labels.clear,imgClass:this.css.filterItemIconClear});conds.push({text:this.options.labels.on,imgClass:this.css.filterItemIconOn,condition:"on"});conds.push({text:this.options.labels.notOn,imgClass:this.css.filterItemIconNotOn,condition:"notOn"});conds.push({text:this.options.labels.after,imgClass:this.css.filterItemIconAfter,condition:"after"});conds.push({text:this.options.labels.before,imgClass:this.css.filterItemIconBefore,condition:"before"});conds.push({text:this.options.labels.today,imgClass:this.css.filterItemIconToday,condition:"today"});conds.push({text:this.options.labels.yesterday,imgClass:this.css.filterItemIconYesterday,condition:"yesterday"});conds.push({text:this.options.labels.thisMonth,imgClass:this.css.filterItemIconThisMonth,condition:"thisMonth"});conds.push({text:this.options.labels.lastMonth,imgClass:this.css.filterItemIconLastMonth,condition:"lastMonth"});conds.push({text:this.options.labels.nextMonth,imgClass:this.css.filterItemIconNextMonth,condition:"nextMonth"});conds.push({text:this.options.labels.thisYear,imgClass:this.css.filterItemIconThisYear,condition:"thisYear"});conds.push({text:this.options.labels.lastYear,imgClass:this.css.filterItemIconLastYear,condition:"lastYear"});conds.push({text:this.options.labels.nextYear,imgClass:this.css.filterItemIconNextYear,condition:"nextYear"});this._renderDropDownToList(obj,conds,ul)}return ul},_renderBooleanFilterDropDown:function(id,colName){var ul=this._renderDropDownElement(id,colName),obj,conds=[],cond;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);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","true")).text(this.options.labels.trueLabel);$("<a></a>").appendTo($("<li></li>").appendTo(ul).addClass(this.css.filterDropDownListItem).data("cond","false")).text(this.options.labels.falseLabel)}else{obj={itemClass:this.css.filterDropDownListItemWithIcons,imgContainerClass:this.css.filterItemIconContainer,textClass:this.css.filterDropDownListItemTextContainer};conds.push({text:this.options.labels.clear,imgClass:this.css.filterItemIconClear});conds.push({text:this.options.labels.trueLabel,imgClass:this.css.filterItemIconTrue,condition:"true"});conds.push({text:this.options.labels.falseLabel,imgClass:this.css.filterItemIconFalse,condition:"false"});this._renderDropDownToList(obj,conds,ul)}return ul},_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.indexOf("_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()}}}}},_animationEnd:function(){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").indexOf("_button"))).find("ul");if(parent.data("selectedItem")){selectedItem=parent.find("li:nth-child("+(parent.data("selectedItem")+1)+")");ddVisible=$("#"+$target.attr("id").substring(0,$target.attr("id").indexOf("_button"))).is(":visible");if($(selectedItem).hasClass("ui-iggrid-filterddlistitemadvanced")&&ddVisible){this._openFilterDialog(event)}}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").indexOf("_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,button,requiresEntry,currentCond;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").indexOf("_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");if($target.data("cond")===undefined){button.attr("title",this.options.tooltipTemplate.replace("${condition}",this.options.labels.noFilter))}else{button.attr("title",this.options.tooltipTemplate.replace("${condition}",$target.text()))}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;if(filterCondition!==undefined){this.options.columnSettings[parseInt(colIndex,10)].condition=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(currentCond==="null"||this.grid.options.columns[colIndex].dataType==="date"){this._editors[colIndex].element.igEditor("option","nullText",this.options.nullTexts[this._getDefaultCondition(this.grid.options.columns[colIndex].dataType)])}}sel=$target.parent().data("selectedItem");if(sel!==undefined){$target.parent().find("li:nth-child("+(sel+1)+")").removeClass(this.css.filterDropDownListItemActive)}$target.addClass(this.css.filterDropDownListItemActive);$target.parent().data("selectedItem",$("li",$target.parent()).index($target));this._editors[colIndex].element.igEditor("option","nullText",this.options.nullTexts[filterCondition]);requiresEntry=this._requiresEntry(filterCondition);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.igEditor("option","disabled",this.grid.options.columns[colIndex].dataType==="bool")}this._editors[colIndex].value(null);this._filterDataSourceClear(this.grid.options.columns[colIndex].key,colIndex)}else{if(!requiresEntry&&!expr){this._editors[colIndex].element.igEditor("option","disabled",true);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].value(null)}if(requiresEntry){this._editors[colIndex].element.igEditor("option","disabled",false)}if(nav===undefined&&filterCondition!==undefined){this._editors[colIndex].setFocus()}}},_requiresEntry:function(filterCondition){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(filterCondition===undefined||filterCondition===null){return false}return true},_editorValueForCondition:function(filterCondition,editor){var date=new Date;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{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)}},_columnFixed:function(args){var i,colInd=args.colInd,cs,editor,fixedColumnsLength=args.fixedColsCount;cs=this.options.columnSettings[colInd];if(cs){this.options.columnSettings.splice(colInd,1);this.options.columnSettings.splice(fixedColumnsLength-1,0,cs)}editor=this._editors[colInd];if(editor){this._editors.splice(colInd,1);this._editors.splice(fixedColumnsLength-1,0,editor);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)}}},_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.container().find("thead").find("[data-role=filterrow]");filterrow.find("[data-skip=true]").remove();this.grid._headerInit(filterrow,null,true)},_injectGrid:function(gridInstance,isRebind){this.grid=gridInstance;if(this.options.type===null){this.options.type=this.grid._inferOpType()}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._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.options.width===null)&&this.grid.options.columnVirtualization===false&&this.options.mode===null){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:"14.1.20141.1020"})})(jQuery);(function($){$(document).ready(function(){var wm=$("#__ig_wm__").length>0?$("#__ig_wm__"):$('<div id="__ig_wm__"></div>').appendTo(document.body);wm.css({position:"fixed",bottom:0,right:0,zIndex:1e3}).addClass("ui-igtrialwatermark")})})(jQuery);