!function(A){A.extend(A.jqx._jqxGrid.prototype,{_handledblclick:function(e,t){var i,l;if(null!=e.target&&!(t.disabled||A(e.target).ischildof(this.columnsheader)||(e.which?i=3==e.which:e.button&&(i=2==e.button),i||(e.which?l=2==e.which:e.button&&(l=1==e.button),l)))){var o=this.showheader?this.columnsheader.height()+2:0,s=this._groupsheader()?this.groupsheader.height():0;s+=this.showtoolbar?this.toolbarheight:0,s+=this.showfilterbar?this.toolbarheight:0;var d=this.host.offset(),a=e.pageX-d.left,r=e.pageY-o-d.top-s,n=this._hittestrow(a,r);if(n){var c=n.row,h=n.index,u=e.target.className,p=this.table[0].rows[h];if(null!=p){t.mousecaptured=!0,t.mousecaptureposition={left:e.pageX,top:e.pageY-s};for(var f=this.hScrollInstance.value,m=0,v=(this.groupable&&this.groups.length,0);v
this.dataview.pagenum&&setTimeout(function(){t.pagerpageinput.focus()},25))}t.begincelledit(v,u),null!=this.editcell&&"checkbox"==this.editcell.columntype&&this._renderrows(this.virtualsizeinfo)}return!1}if(13==o){var T,C,k=this.selectedcell;return k&&(T=this.getrowvisibleindex(k.rowindex)),this.endcelledit(this.editcell.row,this.editcell.column,!1,!0),"multiplecellsadvanced"==this.selectionmode&&null!=(H=t.getselectedcell())&&t.selectcell&&null==this.editcell&&H.rowindex+1=this.pagesize&&(this.clearselection(!1),C=this.dataview.loadedrecords[T],this.selectcell(this.getboundindex(C),H.datafield)))),!1}if(27==o)return this.endcelledit(this.editcell.row,this.editcell.column,!0,!0),!1}else{var z,S=113==o?!0:!1;if(!e.ctrlKey&&!e.altKey&&!e.metaKey){48<=o&&o<=57&&(this.editchar=String.fromCharCode(o),S=!0),189===o&&(S=!0),65<=o&&o<=90?(this.editchar=String.fromCharCode(o),z=!1,e.shiftKey?z=e.shiftKey:e.modifiers&&(z=!!(4&e.modifiers)),this._capsLock&&(z=!z),z||(this.editchar=this.editchar.toLowerCase()),S=!0):96<=o&&o<=105&&(this.editchar=o-96,this.editchar=this.editchar.toString(),S=!0);var O=A(".jqx-grid").length,S=S&&(1==O||1"):C).css("top",A(t).parent().position().top),this.oldhscroll?h.css("left",-p+parseInt(A(t).position().left)):h.css("left",parseInt(A(t).position().left)),n.pinned&&h.css("left",p+parseInt(A(t).position().left)),null==C&&(h.prependTo(this.table),h[0].id="dropdownlisteditor"+this.element.id+D,S=null,S=!!this.source._source?(O={localdata:JSON.parse(JSON.stringify(this.source.records)),datatype:this.source.datatype,async:!1},new A.jqx.dataAdapter(O,{autoBind:!1,async:!1,uniqueDataFields:[T],autoSort:!0,autoSortField:T})):new A.jqx.dataAdapter(this.source,{autoBind:!1,uniqueDataFields:[T],async:!1,autoSort:!0,autoSortField:T}),B=!n.createeditor,h.jqxDropDownList({hint:!1,enableBrowserBoundsDetection:!0,keyboardSelection:!1,source:S,rtl:this.rtl,autoDropDownHeight:B,theme:this.theme,width:d.width(),height:d.height(),displayMember:T,valueMember:s}),this.editors["dropdownlist_"+D]=h,n.createeditor&&n.createeditor(e,a,h)),n._requirewidthupdate&&h.jqxDropDownList({width:d.width()});var k=h.jqxDropDownList("listBox").visibleItems;n.createeditor||(k.length<8?h.jqxDropDownList("autoDropDownHeight",!0):h.jqxDropDownList("autoDropDownHeight",!1));var a=this.getcellvalue(e,T),z=this.findRecordIndex(a,T,k);if(i&&(""!=a?h.jqxDropDownList("selectIndex",z,!0):h.jqxDropDownList("selectIndex",-1)),!this.editcell)return;null!=this.editcell.defaultvalue&&h.jqxDropDownList("selectIndex",this.editcell.defaultvalue,!0),l&&h.jqxDropDownList("focus")}break;case"combobox":if(this.host.jqxComboBox){t.innerHTML="";var D=A.trim(n.datafield).split(" ").join(""),T=A.trim(n.displayfield).split(" ").join("");-1!=D.indexOf(".")&&(D=D.replace(".","")),-1!=T.indexOf(".")&&(T=T.replace(".",""));var S,O,B,N=this.editors["combobox_"+D];(h=null==N?A(""):N).css("top",A(t).parent().position().top),this.oldhscroll?h.css("left",-p+parseInt(A(t).position().left)):h.css("left",parseInt(A(t).position().left)),n.pinned&&h.css("left",p+parseInt(A(t).position().left)),null==N&&(h.prependTo(this.table),h[0].id="comboboxeditor"+this.element.id+D,S=null,S=!!this.source._source?(O={localdata:JSON.parse(JSON.stringify(this.source.records)),datatype:this.source.datatype,async:!1},new A.jqx.dataAdapter(O,{autoBind:!1,async:!1,uniqueDataFields:[T],autoSort:!0,autoSortField:T})):new A.jqx.dataAdapter(this.source,{autoBind:!1,uniqueDataFields:[T],async:!1,autoSort:!0,autoSortField:T}),B=!n.createeditor,h.jqxComboBox({hint:!1,enableBrowserBoundsDetection:!0,keyboardSelection:!1,source:S,rtl:this.rtl,autoDropDownHeight:B,theme:this.theme,width:d.width(),height:d.height(),displayMember:T,valueMember:s}),h.removeAttr("tabindex"),h.find("div").removeAttr("tabindex"),this.editors["combobox_"+D]=h,n.createeditor&&n.createeditor(e,a,h)),n._requirewidthupdate&&h.jqxComboBox({width:d.width()-2});k=h.jqxComboBox("listBox").visibleItems;n.createeditor||(k.length<8?h.jqxComboBox("autoDropDownHeight",!0):h.jqxComboBox("autoDropDownHeight",!1));a=this.getcellvalue(e,T),z=this.findRecordIndex(a,T,k);if(i&&(""!=a?h.jqxComboBox("selectIndex",z,!0):h.jqxComboBox("selectIndex",-1),h.jqxComboBox("val",a)),!this.editcell)return;null!=this.editcell.defaultvalue&&h.jqxComboBox("selectIndex",this.editcell.defaultvalue,!0),this.editchar&&0"):m).show(),h.css("top",A(t).parent().position().top),this.oldhscroll?h.css("left",-p+parseInt(A(t).position().left)):h.css("left",parseInt(A(t).position().left)),n.pinned&&h.css("left",p+parseInt(A(t).position().left)),null==m&&(h.prependTo(this.table),h[0].id="datetimeeditor"+this.element.id+D,v={calendar:this.gridlocalization},h.jqxDateTimeInput({hint:!1,firstDayOfWeek:this.gridlocalization.firstDay,enableBrowserBoundsDetection:!0,localization:v,_editor:!0,theme:this.theme,rtl:this.rtl,width:d.width(),height:d.height(),formatString:n.cellsformat}),this.editors["datetimeinput_"+D]=h,n.createeditor&&n.createeditor(e,a,h)),n._requirewidthupdate&&h.jqxDateTimeInput({width:d.width()}),i&&(""!=a&&null!=a?("Invalid Date"==(x=new Date(a))&&this.source.getvaluebytype&&(x=this.source.getvaluebytype(a,{name:n.datafield,type:"date"})),h.jqxDateTimeInput("setDate",x)):h.jqxDateTimeInput("setDate",null),null!=this.editcell.defaultvalue&&h.jqxDateTimeInput("setDate",this.editcell.defaultvalue)),l&&(w=this.editEvent,setTimeout(function(){f(h.jqxDateTimeInput("dateTimeInput")),setTimeout(function(){var e,t;h.jqxDateTimeInput("_selectGroup",0),c.editchar&&0"):g).show(),h.css("top",A(t).parent().position().top),this.oldhscroll?h.css("left",-p+parseInt(A(t).position().left)):h.css("left",parseInt(A(t).position().left)),n.pinned&&h.css("left",p+parseInt(A(t).position().left)),null==g&&(h.prependTo(this.table),h[0].id="numbereditor"+this.element.id+D,b="",y="left",_=2,n.cellsformat?-1!=n.cellsformat.indexOf("c")?(b=this.gridlocalization.currencysymbol,y="before"==(y=this.gridlocalization.currencysymbolposition)?"left":"right",1"):j).show(),h.css("top",A(t).parent().position().top),this.oldhscroll?h.css("left",-p+parseInt(A(t).position().left)):h.css("left",parseInt(A(t).position().left)),n.pinned&&h.css("left",p+parseInt(A(t).position().left)),null==j&&(h.prependTo(this.table),h[0].id="ratingEditor"+this.element.id+D,h.jqxRating({theme:this.theme,width:d.width(),height:d.height()}),this.editors["numberinput_"+D]=h,n.createeditor&&n.createeditor(e,a,h)),n._requirewidthupdate&&h.jqxRating({width:d.width()}),i&&(""!=a&&null!=a?(I=a,h.jqxRating("val",I)):h.jqxRating("val",0),null!=this.editcell.defaultvalue&&h.jqxRating("val",this.editcell.defaultvalue)));break;case"custom":t.innerHTML="",-1!=(D=A.trim(n.datafield).split(" ").join("")).indexOf(".")&&(D=D.replace(".",""));var L=this.editors["customeditor_"+D+"_"+e];(h=null==L?A(""):L).show(),h.css("top",A(t).parent().position().top),this.oldhscroll?h.css("left",-p+parseInt(A(t).position().left)):h.css("left",parseInt(A(t).position().left)),n.pinned&&h.css("left",p+parseInt(A(t).position().left)),null==L&&(h.prependTo(this.table),h[0].id="customeditor"+this.element.id+D+"_"+e,this.editors["customeditor_"+D+"_"+e]=h,E=d.width()-1,H=d.height()-1,h.width(E),h.height(H),n.createeditor&&n.createeditor(e,a,h,r,E,H,this.editchar)),n._requirewidthupdate&&h.width(d.width());break;case"template":t.innerHTML="",-1!=(D=A.trim(n.datafield).split(" ").join("")).indexOf(".")&&(D=D.replace(".",""));var E,H,M=this.editors["templateeditor_"+D];(h=null==M?A(""):M).show(),h.css("top",A(t).parent().position().top),this.oldhscroll?h.css("left",-p+parseInt(A(t).position().left)):h.css("left",parseInt(A(t).position().left)),n.pinned&&h.css("left",p+parseInt(A(t).position().left)),null==M&&(h.prependTo(this.table),h[0].id="templateeditor"+this.element.id+D,this.editors["templateeditor_"+D]=h,E=d.width()-1,H=d.height()-1,h.width(E),h.height(H),n.createeditor&&n.createeditor(e,a,h,r,E,H,this.editchar)),n._requirewidthupdate&&h.width(d.width());break;case"textbox":default:t.innerHTML="",(h=this.editors["textboxeditor_"+n.datafield]||A(""))[0].id="textboxeditor"+this.element.id+n.datafield,h.appendTo(d),this.rtl&&h.css("direction","rtl"),!i&&""!=h[0].className||(h.addClass(this.toThemeProperty("jqx-input")),h.addClass(this.toThemeProperty("jqx-widget-content")),this.editchar&&0d.indexOf(c.gridlocalization.decimalseparator))return!0;for(var a=0;a"),t=A("");e.html(o),t.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),e.addClass(this.toThemeProperty("jqx-grid-validation")),e.addClass(this.toThemeProperty("jqx-rc-all")),e.prependTo(this.table),t.prependTo(this.table);for(var s=this.hScrollInstance.value,d=parseInt(s),a=this.getcolumn(l).uielement,r=null,n=0;n=this._gettableheight()-this.rowsheight&&(t.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),t.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),(u=parseInt(h.position().top)-this.rowsheight)<0&&(u=0,this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),p=!0),e.css("top",u+"px"),t.css("top",u+e.outerHeight()-9));var f=-d+parseInt(A(a).position().left);0===a[0].offsetHeight&&(f=-d+parseInt(a[0].style.left)),t.css("left",d+f+30);var m=e.width();m+f>this.host.width()-20&&(f-=m+f-this.host.width()+40),p?e.css("left",d+parseInt(A(a).position().left)-e.outerWidth()):e.css("left",d+f),e.show(),t.show(),this.popups||(this.popups=new Array),this.popups[this.popups.length]={validation:e,validationrow:t}},_showvalidationpopup:function(e,t,i){var l,o,s,d,a,r,n,c,h=this.editcell,u=this.editcell.editor;"selectedrow"==this.editmode&&(h=this.editcell[t])&&h.editor&&(u=h.editor,h.element=u),u&&(this.validationpopup&&A.jqx.isHidden(this.validationpopup)&&(this.validationpopup.remove&&(this.validationpopup.remove(),this.validationpopuparrow.remove()),this.validationpopup=null,this.validationpopuparrow=null,void 0===t&&void 0===i&&this.editors&&0===this.editors.length)||(this.validationpopup?this.validationpopup.html(i):(l=A(""),o=A(""),l.html(i),o.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),l.addClass(this.toThemeProperty("jqx-grid-validation")),l.addClass(this.toThemeProperty("jqx-rc-all")),l.prependTo(this.table),o.prependTo(this.table),this.validationpopup=l,this.validationpopuparrow=o),s=this.hScrollInstance.value,d=parseInt(s),"selectedrow"==this.editmode?this.visiblerows&&this.visiblerows[this.editcell.visiblerowindex]?this.validationpopup.css("top",this.visiblerows[this.editcell.visiblerowindex].top+(this.rowsheight+5)+"px"):this.validationpopup.css("top",parseInt(A(h.editor).position().top)+(this.rowsheight+5)+"px"):this.validationpopup.css("top",parseInt(A(h.element).parent().position().top)+(this.rowsheight+5)+"px"),a=parseInt(this.validationpopup.css("top")),this.validationpopuparrow.css("top",a-11),this.validationpopuparrow.removeClass(),this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),r=!1,this._gettableheight()<=a&&(this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),a=parseInt(A(h.element).parent().position().top)-this.rowsheight-5,"selectedrow"==this.editmode&&(a=this.visiblerows&&this.visiblerows[this.editcell.visiblerowindex]?this.visiblerows[this.editcell.visiblerowindex].top-this.rowsheight-5:parseInt(A(h.editor).position().top)-this.rowsheight-5),a<0&&(a=0,this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),r=!0),this.validationpopup.css("top",a+"px"),this.validationpopuparrow.css("top",a+this.validationpopup.outerHeight()-9)),n=-d+parseInt(A(h.element).position().left),this.validationpopuparrow.css("left",d+n+30),(c=this.validationpopup.width())+n>this.host.width()-20&&(n-=c+n-this.host.width()+40),r?this.validationpopup.css("left",d+parseInt(A(h.element).position().left)-this.validationpopup.outerWidth()):this.validationpopup.css("left",d+n),"none"==this.editcell.editor.css("display")?(this.validationpopup.hide(),this.validationpopuparrow.hide()):(this.validationpopup.show(),this.validationpopuparrow.show())))}})}(jqxBaseFramework);