").attr({"class":"ui-widget-header ui-priority-secondary","data-rs-overlay":!!toCheck,tabIndex:ti,id:this.grid.id()+(toCheck?"_":"_de")+"select_all_overlay"}).append($("
").html(template).append($("
").css("float","right").append($("").addClass("ui-icon-close").addClass("ui-icon").addClass("ui-button").attr("data-rs-close-all","").attr("tabindex",ti))))},_registerSelectAllEvents:function(overlay){var self=this,overlayId=overlay.attr("id");this.grid.container().bind("mouseup.containerselectall",function(event){if(event.type==="mouseup"&&$(event.target).closest("#"+overlayId).length===0){$(this).unbind(".containerselectall");if($(overlay)){overlay.remove()}}});overlay.bind("blur.containerselectall",function(event){$(this).unbind(".containerselectall");if($(overlay)&&$(event.target).closest("#"+overlayId).length===0){overlay.remove()}});overlay.find("[data-rs-select-all]").bind("mouseup",function(event){self._selectAllFromOverlay();event.stopPropagation();overlay.remove()});overlay.find("[data-rs-deselect-all]").bind("mouseup",function(event){self._deselectAllFromOverlay();event.stopPropagation();overlay.remove()});overlay.find("[data-rs-select-all]").bind("keydown",function(event){if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){self._selectAllFromOverlay();overlay.remove()}});overlay.find("[data-rs-deselect-all]").bind("keydown",function(event){if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){self._deselectAllFromOverlay();overlay.remove()}});overlay.find("[data-rs-close-all]").bind("mouseup",function(event){event.stopPropagation();overlay.remove()});overlay.find("[data-rs-close-all]").bind("keydown",function(event){if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){overlay.remove()}})},_selectAllFromOverlay:function(){this._changeCheckStateForAllRecords(this._getSelectionInstance(),true)},_deselectAllFromOverlay:function(){this._changeCheckStateForAllRecords(this._getSelectionInstance(),false)},_unregisterSelectAllEvents:function(){if(this.grid.element.data("igGridPaging")&&this.options.enableSelectAllForPaging){this.grid.container().unbind(".containerselectall");$(this.grid.id()+"_select_all_overlay").remove();$(this.grid.id()+"_deselect_all_overlay").remove()}},_updateHeader:function(){var dv=this._getDataView(),dvl=dv.length,sl,i,check=!!dvl,selection=this._getSelectionInstance(),pk=selection._pkProp;if(this.grid.element.data("igGridPaging")){for(i=0;i0&&inner.length>0){if(check===true){checkbox.attr("data-chk","on");inner.removeClass(this.css.checkBoxOff).addClass(this.css.checkBoxOn)}else{checkbox.attr("data-chk","off");inner.removeClass(this.css.checkBoxOn).addClass(this.css.checkBoxOff)}}},_getRowSelectorCellMarkup:function(selected){var markup="";markup+='';if(this.options.enableRowNumbering){markup+=this._getCurrentNumber()}if(this.options.enableCheckBoxes){markup+=this._getCheckBox(false,selected)}markup+=" | ";return markup},_getCheckBox:function(header,checked){var markup="";markup+='';markup+="";return markup},_getCurrentNumber:function(){return''+(++this._cIdx+this.options.rowNumberingSeed)+""},_selectAllRows:function(selection){var checkboxes=this._allCheckboxes(),i,range=[],row,rowId;if(checkboxes.length===0){return}for(i=0;i tr").eq(row.index()))}else{row=row.add(this.grid.fixedBodyContainer().find("tbody > tr").eq(row.index()))}}rowId=selection._pkProp?this.grid._fixPKValue(row.attr("data-id")):i;range.push({id:rowId,element:row,checkbox:checkboxes.eq(i)})}this._suspendHeader=true;this.grid._selection.rangeSelect(range,true,null,false,false);this._suspendHeader=false},_selectAllVirtualRows:function(selection){var dv=this._getDataView(),fr,lr,rangeStats;if(dv.length===0){return}if(selection._pkProp){fr=dv[0].__gbRecord?dv[0].id:dv[0][selection._pkProp];lr=dv[dv.length-1].__gbRecord?dv[dv.length-1].id:dv[dv.length-1][selection._pkProp]}else{fr=0;lr=dv.length-1}rangeStats=selection._getRecordRange(fr,lr,dv);this._suspendHeader=true;this.grid._selection.rangeSelect(rangeStats.range,true,null,false,false);if(this.grid.options.virtualizationMode==="continuous"){this.grid._correctScrollPosition(this.grid._getTotalRowsCount())}this._suspendHeader=false},_changeCheckStateForAllRecords:function(selection,toCheck){var dv=this._getDSLocalRecords(),fr,lr,rangeStats;if(dv.length===0){return}if(selection._pkProp){fr=dv[0][selection._pkProp];lr=dv[dv.length-1][selection._pkProp]}else{fr=0;lr=dv.length-1}rangeStats=selection._getRecordRange(fr,lr,dv);this._suspendHeader=true;if(toCheck){this.grid._selection.rangeSelect(rangeStats.range,true,null,rangeStats,false)}else{this.grid._selection.rangeDeselect(rangeStats.range,rangeStats,false)}this._suspendHeader=false},_deselectAllRows:function(selection){var checkboxes=this._allCheckboxes(),i,row,rowId,range=[];if(checkboxes.length===0){return}if(this.grid.element.data("igGridPaging")){for(i=0;i tr").eq(i))}rowId=selection._pkProp?this.grid._fixPKValue(row.attr("data-id")):i;range.push({id:rowId,element:row,checkbox:checkboxes.eq(i)})}this._suspendHeader=true;this.grid._selection.rangeDeselect(range,false,false);this._suspendHeader=false}else{this.grid._selection.deselectAll(false)}},_deselectAllVirtualRows:function(selection){var dv=this._getDataView(),rangeStats,fr,lr;if(dv.length===0){return}if(this.grid.element.data("igGridPaging")){if(selection._pkProp){fr=dv[0][selection._pkProp];lr=dv[dv.length-1][selection._pkProp]}else{fr=0;lr=dv.length-1}rangeStats=selection._getRecordRange(fr,lr,dv);this._suspendHeader=true;this.grid._selection.rangeDeselect(rangeStats.range,false,false);this._suspendHeader=false}else{this.grid._selection.deselectAll(false)}},_isFirstRowSelected:function(){var row=this.grid.element.find("tbody > tr:not([data-grouprow='true'],[data-summaryrow='true']):first"),rowId=row.attr("data-id");rowId=rowId!==null&&rowId!==undefined?this.grid._fixPKValue(rowId):this.grid.dataSource.pageIndex()*this.grid.dataSource.pageSize();return this.grid._selection.isSelected(rowId,this.grid)},_rowHasSelection:function(data){var sel=this._getSelectionInstance(),rowId=data[this.grid.options.primaryKey||"ig_pk"];if(!sel||rowId===null||rowId===undefined){return false}if(sel.options.mode==="cell"){return this.grid._selection.atLeastOneSelected(rowId,sel)}return this.grid._selection.isSelected(rowId,this.grid)},_rsRenderVirtualRecords:function(event,ui){var i=0,rs,rows,rowsLen;this._cIdx=0;if(this.grid.hasFixedColumns()&&this._getColumnFixingInstance().options.fixingDirection==="left"){rows=ui.fixedRows}else{rows=ui.rows}rowsLen=rows.length;for(i;i tr").eq(fRow.index())}else{fRow=this.grid.fixedBodyContainer().find("tbody > tr").eq(rRow.index())}}fdCell=this._getFirstDataCell(rRow,fRow);if(event.shiftKey&&this._ms){sel._shiftSelectChange(fdCell)}else{sel._singleSelectChange(fdCell,event.ctrlKey||event.metaKey)}args={row:rRow,fixedRow:fRow,rowIndex:rIdx,rowKey:rKey,rowSelector:rCell,owner:this,grid:this.grid};this._triggerClickEvent(event,args)},_getFirstDataCell:function(row,frow){if(frow&&frow.length>0){frow.children("td").not("[data-skip='true'],[data-parent='true']").first()}return row.children("td").not("[data-skip='true'],[data-parent='true']").first()},_mouseHoverRow:function(event){var par,tag,tr=event.target;while(tr){par=tr.parentNode;tag=tr.nodeName;if(tag==="TR"&&par.nodeName==="TBODY"){break}tr=tag==="TABLE"?null:par}if(this._hovTR!==tr){this._mouseHoverRowHelper(this._hovTR,tr);if(this.grid.hasFixedColumns()){this._mouseHoverFixedRow($(this._hovTR),$(tr))}this._hovTR=tr}},_mouseHoverRowHelper:function(hovTr,tr){if(hovTr&&$(hovTr).attr("data-container")!=="true"){$("th."+this.css.rowSelector,hovTr).removeClass(this.css.nodeHovered)}if(tr&&$(tr).attr("data-container")!=="true"){$("th."+this.css.rowSelector,tr).addClass(this.css.nodeHovered)}},_mouseHoverFixedRow:function($hovTR,$tr){var $fHTR,$fTR,ind;ind=$hovTR.index();$fHTR=this.grid.fixedBodyContainer().find("tr:nth-child("+(ind+1)+")");ind=$tr.index();$fTR=this.grid.fixedBodyContainer().find("tr:nth-child("+(ind+1)+")");this._mouseHoverRowHelper($fHTR,$fTR)},_mouseLeaveRow:function(){var ind,$fHTR;if(this._hovTR){$("th",this._hovTR).removeClass(this.css.nodeHovered);if(this.grid.hasFixedColumns()){ind=$(this._hovTR).index();$fHTR=this.grid.fixedBodyContainer().find("tr:nth-child("+(ind+1)+")");$fHTR.find("th").removeClass(this.css.nodeHovered)}this._hovTR=null}},_triggerClickEvent:function(event,args){this._trigger(this.events.rowSelectorClicked,event,args)},_triggerCheckingEvent:function(event,args){return this._trigger(this.events.checkBoxStateChanging,event,args)},_triggerCheckedEvent:function(event,args){this._trigger(this.events.checkBoxStateChanged,event,args)},_getVisibleRowIndex:function(row){return row.closest("tbody").children("tr:not([data-container='true'],[data-grouprow='true'],[data-summaryrow='true'])").index(row)},_getVisibleHRowIndex:function(row){return row.closest("tbody").children("tr:not([data-container='true'])").index(row)},_animateCheckboxes:function(trans){var h=this._headerCheckbox(),c=this._allCheckboxes(),all=h.add(c);if(trans===true){all.css("visibility","visible").css("opacity",0).animate({opacity:1},1e3)}else{all.css("opacity",1e3).animate({opacity:0},1e3,function(){$(this).css("visibility","hidden")})}this._checkBoxesShown=trans},_cleanInterface:function(isRebind){var header,footer,cols,rsCells,w;if(isRebind===true){this._alterCheckbox(this._headerCheckbox(),false);return}cols=this.grid.element.children("colgroup").children("[data-role='rs']");cols=cols.add(this.grid.fixedBodyContainer().find("colgroup").children("[data-role='rs']"));if(this.grid.options.fixedHeaders===true){cols=cols.add(this.grid.headersTable().children("colgroup").children("[data-role='rs']"));cols=cols.add(this.grid.fixedHeadersTable().children("colgroup").children("[data-role='rs']"))}if(this.grid.options.fixedFooters===true){cols=cols.add(this.grid.footersTable().children("colgroup").children("[data-role='rs']"));cols=cols.add(this.grid.fixedFootersTable().children("colgroup").children("[data-role='rs']"))}footer=this._footerRowSelectorCells();header=this._headerRowSelectorCells();rsCells=this._allRowSelectorCells();if(!this.grid.options.width&&this._functionsRedirected){w=this.grid.container().css("width");if(w&&!w.endsWith("%")){this.grid.container().css("width",parseInt(w,10)-this.options.rowSelectorColumnWidth)}}cols.remove();footer.remove();header.remove();rsCells.remove()},_allRowSelectorCells:function(){var rowSelectors,grid=this.grid;if(grid.hasFixedColumns()&&this._getColumnFixingInstance().options.fixingDirection==="left"){if(grid.options.virtualization||grid.options.rowVirtualization){rowSelectors=grid.fixedBodyContainer().find("tbody > tr > th."+this.css.rowSelector)}else{rowSelectors=grid.fixedBodyContainer().find("tbody > tr > th."+this.css.rowSelector)}}else{rowSelectors=grid.element.children("tbody").children("tr").children("th."+this.css.rowSelector);
}return rowSelectors},_headerRowSelectorCells:function(){var headerCells=this.grid.headersTable().children("thead").find("th[data-role='rs']");if(headerCells.length===0&&this.grid.hasFixedColumns()){headerCells=this.grid.fixedHeadersTable().children("thead").find("th[data-role='rs']")}return headerCells},_footerRowSelectorCells:function(){var footerCells=this.grid.footersTable().children("tfoot").find("td[data-role='rs']");if(footerCells.length===0&&this.grid.hasFixedColumns()){footerCells=this.grid.fixedFootersTable().children("tfoot").find("td[data-role='rs']")}return footerCells},_allCheckboxes:function(){var checkboxes=this.grid.element.children("tbody").children("tr").children("th").find("span[name='chk']");if(checkboxes.length===0&&this.grid.hasFixedColumns()&&this._getColumnFixingInstance().options.fixingDirection==="left"){checkboxes=this.grid.fixedBodyContainer().find("tbody > tr > th span[name='chk']")}return checkboxes},_headerCheckbox:function(){var checkbox=this.grid.headersTable().children("thead").find("tr > th span[name='hchk']");if(checkbox.length===0&&this.grid.hasFixedColumns()&&this._getColumnFixingInstance().options.fixingDirection==="left"){checkbox=this.grid.fixedHeadersTable().children("thead").find("tr > th span[name='hchk']")}return checkbox},_rowSelectorFromSelection:function(info){var element=info.element,rs,checkbox=info.checkbox,fixingDir;if(element.is("th")){return}if(checkbox){rs=checkbox.parent()}else{if(element.is("tr")||element.length===2){rs=element.children("th:first")}else if(this.grid.hasFixedColumns()){fixingDir=this.grid.fixedBodyContainer().attr("data-fixing-direction");if(fixingDir==="left"&&!this.grid._isFixedElement(element)){rs=this.grid.fixedBodyContainer().find("tbody > tr").eq(element.closest("tr").index()).children("th:first")}else if(fixingDir==="right"&&this.grid._isFixedElement(element)){rs=this.grid.element.find("tbody > tr").eq(element.closest("tr").index()).children("th:first")}}if(!rs){rs=element.closest("tr").children("th:first")}checkbox=this.options.enableCheckBoxes?rs.children("span:last"):null}return{rowSelector:rs,checkbox:checkbox}},_checkForSelection:function(){var i,isSelection=false;for(i=0;i