www-thermferm/jqwidgets/jqxgrid.edit.js

changeset 511
2d1d43c3a2c2
parent 373
f6850e0b5d35
child 617
b216f9d4b917
equal deleted inserted replaced
510:2da3d3340403 511:2d1d43c3a2c2
1 /* 1 /*
2 jQWidgets v3.8.0 (2015-Apr) 2 jQWidgets v4.5.2 (2017-May)
3 Copyright (c) 2011-2015 jQWidgets. 3 Copyright (c) 2011-2017 jQWidgets.
4 License: http://jqwidgets.com/license/ 4 License: http://jqwidgets.com/license/
5 */ 5 */
6 !function(a){a.extend(a.jqx._jqxGrid.prototype,{_handledblclick:function(b,c){if(null!=b.target&&!c.disabled&&!a(b.target).ischildof(this.columnsheader)){var d;if(b.which?d=3==b.which:b.button&&(d=2==b.button),!d){var e;if(b.which?e=2==b.which:b.button&&(e=1==b.button),!e){var f=this.showheader?this.columnsheader.height()+2:0,g=this._groupsheader()?this.groupsheader.height():0,h=this.showtoolbar?this.toolbarheight:0;g+=h;var i=this.host.offset(),j=b.pageX-i.left,k=b.pageY-f-i.top-g,l=this._hittestrow(j,k);if(l){var m=l.row,n=l.index,o=b.target.className,p=this.table[0].rows[n];if(null!=p){c.mousecaptured=!0,c.mousecaptureposition={left:b.pageX,top:b.pageY-g};for(var q=this.hScrollInstance,r=q.value,s=0,t=(this.groupable?this.groups.length:0,0);t<p.cells.length;t++){var u=parseInt(a(this.columnsrow[0].cells[t]).css("left")),v=u-r;c.columns.records[t].pinned&&(v=u);var w=this._getcolumnat(t);if(null==w||!w.hidden){var x=v+a(this.columnsrow[0].cells[t]).width();if(x>=j&&j>=v){s=t;break}}}if(null!=m){var w=this._getcolumnat(s);o.indexOf("jqx-grid-group-expand")==-1&&o.indexOf("jqx-grid-group-collapse")==-1&&m.boundindex!=-1&&c.begincelledit(c.getboundindex(m),w.datafield,w.defaulteditorvalue)}}}}}}},_getpreveditablecolumn:function(a){for(var b=this;a>0;){a--;var c=b.getcolumnat(a);if(!c)return null;if(c.editable&&!c.hidden)return c}return null},_getnexteditablecolumn:function(a){for(var b=this;a<this.columns.records.length;){a++;var c=b.getcolumnat(a);if(!c)return null;if(c.editable&&!c.hidden)return c}return null},_handleeditkeydown:function(b,c){if(c.handlekeyboardnavigation){var d=c.handlekeyboardnavigation(b);if(1==d)return!0}var e=b.charCode?b.charCode:b.keyCode?b.keyCode:0;if(c.editEvent=b,c.showfilterrow&&c.filterable&&this.filterrow&&a(b.target).ischildof(this.filterrow))return!0;if(b.target.className&&b.target.className.indexOf("jqx-grid-widget")>=0)return!0;if(c.pageable&&a(b.target).ischildof(this.pager))return!0;if(this.showtoolbar&&a(b.target).ischildof(this.toolbar))return!0;if(this.showeverpresentrow){if(this.addnewrowtop&&a(b.target).ischildof(this.addnewrowtop))return!0;if(this.addnewrowbottom&&a(b.target).ischildof(this.addnewrowbottom))return!0}if(this.showstatusbar&&a(b.target).ischildof(this.statusbar))return!0;if(this.rowdetails&&a(b.target).ischildof(this.content.find("[role='rowgroup']")))return!0;if(this.editcell){if("selectedrow"===this.editmode){if(13===e)return this.endrowedit(this.editcell.row,!1),!1;if(27===e)return this.endrowedit(this.editcell.row,!0),!1;if(32==e&&this._currentColumn&&"checkbox"==this.getcolumn(this._currentColumn).columntype){var f=this.getcolumn(this._currentColumn);if(f.editable){var g=!this.getcellvalue(this.editcell.row,f.datafield),h=this.getrowdata(this.editcell.row),i=this.editcell.row,h=c.getrowdata(c.editcell.row);this.setcellvalue(this.editcell.row,f.datafield,g,!1);var j=this._focusedColumn,k=this._currentColumn,l=this._currentEditableColumn;if(this.endrowedit(this.editcell.row,!1),this.beginrowedit(i,!1),this._currentColumn=k,this._focusedColumn=j,this._currentEditableColumn=l,this._renderrows(),this.selectcell(i,f.datafield),this._oldselectedcell=this.selectedcell,j){var m=this;setTimeout(function(){m.selectcell(i,f.datafield),m._oldselectedcell=m.selectedcell,a(m._checkboxCells[f.datafield].checkbox).jqxCheckBox("focus")},25)}return!1}}if(9===e){var n=this.editcell.datafield,o=this._getcolumnindex(n);this._currentEditableColumn?o=this._currentEditableColumn:this._currentEditableColumn=o;var f=this._getnexteditablecolumn(o);if(b.shiftKey&&(f=this._getpreveditablecolumn(o)),f){var o=this._getcolumnindex(f.datafield);if(this.editcell[f.datafield]){this._currentEditableColumn=o;var p=this.editcell[f.datafield].editor;p&&(p.data().jqxWidget&&p.data().jqxWidget.focus?p.data().jqxWidget.focus():p.focus()),this._focusedColumn=f.datafield,this._currentColumn=f.datafield}else if("checkbox"==f.columntype)return this._currentColumn=f.datafield,this._currentEditableColumn=o,this.selectcell(this.editcell.row,f.datafield),this._oldselectedcell=this.selectedcell,this._checkboxCells[f.datafield]&&a(this._checkboxCells[f.datafield].checkbox).jqxCheckBox("focus"),!1}return!1}return!0}if(null==this.editcell.columntype||"textbox"==this.editcell.columntype||"numberinput"==this.editcell.columntype||"combobox"==this.editcell.columntype||"datetimeinput"==this.editcell.columntype){if(e>=33&&e<=40&&"multiplecellsadvanced"==c.selectionmode){var p="textbox"==this.editcell.columntype||null==this.editcell.columntype?this.editcell.editor:this.editcell.editor.find("input"),q=c._selection(p),r=p.val().length;q.length>0&&"datetimeinput"!=this.editcell.columntype&&(c._cancelkeydown=!0),q.start>0&&37==e&&(c._cancelkeydown=!0),q.start<r&&39==e&&"datetimeinput"!=this.editcell.columntype&&(c._cancelkeydown=!0),"datetimeinput"==this.editcell.columntype&&39==e&&q.start+q.length<r&&(c._cancelkeydown=!0)}}else"dropdownlist"==this.editcell.columntype?(37==e||39==e&&"multiplecellsadvanced"==c.selectionmode)&&(c._cancelkeydown=!1):"multiplecellsadvanced"==this.selectionmode&&"textbox"!=this.editcell.columntype&&"numberinput"!=this.editcell.columntype&&(c._cancelkeydown=!0);if(32==e&&"checkbox"==c.editcell.columntype){var f=c.getcolumn(c.editcell.datafield);if(f.editable){var g=!c.getcellvalue(c.editcell.row,c.editcell.column);if(f.cellbeginedit){var s=f.cellbeginedit(c.editcell.row,f.datafield,f.columntype,!g);if(0==s)return!1}var h=c.getrowdata(c.editcell.row);return c.setcellvalue(c.editcell.row,c.editcell.column,g,!0),c._raiseEvent(18,{rowindex:c.editcell.row,row:h,datafield:c.editcell.column,oldvalue:!g,value:g,columntype:"checkbox"}),!1}}if(9==e){var t=this.editcell.row,n=this.editcell.column,u=n,o=c._getcolumnindex(n),v=!1,w=c.getrowvisibleindex(t);this.editchar="";var x=this.editcell.validated;if(!this.editcell.validated)var x=this.endcelledit(this.editcell.row,this.editcell.column,!1,!0,!1);if(0!=x){if(b.shiftKey){var f=c._getpreveditablecolumn(o);if(f)n=f.datafield,v=!0,c.selectionmode.indexOf("cell")!=-1&&(c.selectprevcell(t,u),c._oldselectedcell=c.selectedcell,setTimeout(function(){c.ensurecellvisible(w,n)},10));else{var y=c._getlastvisiblecolumn();v=!0,n=y.displayfield,t--,c.selectionmode.indexOf("cell")!=-1&&(c.clearselection(),c.selectcell(t,n),c._oldselectedcell=c.selectedcell,setTimeout(function(){c.ensurecellvisible(w,n)},10))}}else{var f=c._getnexteditablecolumn(o);if(f)n=f.datafield,v=!0,c.selectionmode.indexOf("cell")!=-1&&(c.selectnextcell(t,u),c._oldselectedcell=c.selectedcell,setTimeout(function(){c.ensurecellvisible(w,n)},10));else{var z=c._getfirstvisiblecolumn();v=!0,n=z.displayfield,t++,c.selectionmode.indexOf("cell")!=-1&&(c.clearselection(),c.selectcell(t,n),c._oldselectedcell=c.selectedcell,setTimeout(function(){c.ensurecellvisible(w,n)},10))}}if(!v)return null!=this.editcell&&(c.endcelledit(t,n,!1),this._renderrows(this.virtualsizeinfo)),!0;c.begincelledit(t,n),null!=this.editcell&&"checkbox"==this.editcell.columntype&&this._renderrows(this.virtualsizeinfo)}return!1}if(13==e){var A=this.selectedcell;if(A)var B=this.getrowvisibleindex(A.rowindex);if(this.endcelledit(this.editcell.row,this.editcell.column,!1,!0),"multiplecellsadvanced"==this.selectionmode){var C=c.getselectedcell();if(null!=C&&c.selectcell&&null==this.editcell&&C.rowindex+1<this.dataview.totalrecords)if(this.sortcolumn!=C.datafield){var w=this.getrowvisibleindex(C.rowindex),D=this.dataview.loadedrecords[w+1];if(D&&(!this.pageable||this.pageable&&w+1<(this.dataview.pagenum+1)*this.pagesize)){this.clearselection(!1),this.selectcell(this.getboundindex(D),C.datafield);var C=this.getselectedcell();this.ensurecellvisible(D.visibleindex,C.datafield)}}else if(null!=A){var E=this.dataview.loadedrecords[B+1];if(E)if(!this.pageable||this.pageable&&B+1<this.pagesize)this.clearselection(!1),this.selectcell(this.getboundindex(E),C.datafield);else if(this.pageable&&B+1>=this.pagesize){this.clearselection(!1);var E=this.dataview.loadedrecords[B];this.selectcell(this.getboundindex(E),C.datafield)}}}return!1}if(27==e)return this.endcelledit(this.editcell.row,this.editcell.column,!0,!0),!1}else{var F=!1;if(113==e&&(F=!0),!b.ctrlKey&&!b.altKey&&!b.metaKey){if(e>=48&&e<=57&&(this.editchar=String.fromCharCode(e),F=!0),189===e&&(F=!0),e>=65&&e<=90){this.editchar=String.fromCharCode(e);var G=!1;b.shiftKey?G=b.shiftKey:b.modifiers&&(G=!!(4&b.modifiers)),G||(this.editchar=this.editchar.toLowerCase()),F=!0}else e>=96&&e<=105&&(this.editchar=e-96,this.editchar=this.editchar.toString(),F=!0);var H=a(".jqx-grid").length;F=F&&(1==H||H>1&&c.focused);var I=a.data(document.body,"jqxgrid.edit");if(void 0!==I&&""!==I&&(13===e||F)&&I!=c.element.id)return!0}if((13==e||F)&&c.getselectedrowindex){var t=c.getselectedrowindex();if("selectedrow"===c.editmode)return c.beginrowedit(t),!1;switch(c.selectionmode){case"singlerow":case"multiplerows":case"multiplerowsextended":if(t>=0){for(var n="",J=0;J<c.columns.records.length;J++){var f=c.getcolumnat(J);if(f.editable){n=f.datafield;break}}"selectedrow"===c.editmode?c.beginrowedit(t):c.begincelledit(t,n)}break;case"singlecell":case"multiplecells":case"multiplecellsextended":var C=c.getselectedcell();if(null!=C){var f=c._getcolumnbydatafield(C.datafield);"checkbox"!=f.columntype&&c.begincelledit(C.rowindex,C.datafield)}break;case"multiplecellsadvanced":var C=c.getselectedcell();if(null!=C)if(13==e){if(c.selectcell){var w=this.getrowvisibleindex(C.rowindex);if(w+1<c.dataview.totalrecords){var D=this.dataview.loadedrecords[w+1];if(D){this.clearselection(!1),this.selectcell(this.getboundindex(D),C.datafield);var C=this.getselectedcell();this.ensurecellvisible(D.visibleindex,C.datafield)}}}}else"selectedrow"!==c.editmode&&c.begincelledit(C.rowindex,C.datafield)}return!1}if(46==e){var K=c.getselectedcells();if(c.selectionmode.indexOf("cell")==-1&&c._getcellsforcopypaste&&(K=c._getcellsforcopypaste()),null!=K&&K.length>0){for(var L=0;L<K.length;L++){var C=K[L];if(C.datafield){var f=c.getcolumn(C.datafield),M=c.getcellvalue(C.rowindex,C.datafield);if(""!==M&&f.editable&&c.enablekeyboarddelete){var N=null;if("checkbox"==f.columntype&&(f.threestatecheckbox||(N=!1)),f.cellbeginedit){var s=f.cellbeginedit(C.rowindex,f.datafield,f.columntype,N);if(0==s)return!1}var h=c.getrowdata(C.rowindex);if(c._raiseEvent(17,{rowindex:C.rowindex,row:h,datafield:C.datafield,value:M}),L==K.length-1?(c.setcellvalue(C.rowindex,C.datafield,N,!0),f.displayfield!=f.datafield&&c.setcellvalue(C.rowindex,f.displayfield,N,!0)):(c.setcellvalue(C.rowindex,C.datafield,N,!1),f.displayfield!=f.datafield&&c.setcellvalue(C.rowindex,f.displayfield,N,!0)),f.cellendedit){f.cellendedit(C.rowindex,f.datafield,f.columntype,N)}c._raiseEvent(18,{rowindex:C.rowindex,row:h,datafield:C.datafield,oldvalue:M,value:N})}}}return this.dataview.updateview(),this._renderrows(this.virtualsizeinfo),!1}}if(32==e){var C=c.getselectedcell();if(null!=C){var f=c.getcolumn(C.datafield);if("checkbox"==f.columntype&&f.editable){var g=!c.getcellvalue(C.rowindex,C.datafield);if(f.cellbeginedit){var s=f.cellbeginedit(C.rowindex,f.datafield,f.columntype,!g);if(0==s)return!1}var h=c.getrowdata(C.rowindex);return c._raiseEvent(17,{rowindex:C.rowindex,row:h,datafield:C.datafield,value:!g,columntype:"checkbox"}),c.setcellvalue(C.rowindex,C.datafield,g,!0),c._raiseEvent(18,{rowindex:C.rowindex,row:h,datafield:C.datafield,oldvalue:!g,value:g,columntype:"checkbox"}),!1}}}}return!0},begincelledit:function(b,c,d,e,f){var g=this.getcolumn(c);if(this._cellscache=new Array,null!=c&&"number"!=g.columntype&&"button"!=g.columntype&&!g.createwidget){if(this.groupable){if(this.groups.indexOf(c)>=0)return;if(this.groups.indexOf(g.displayfield)>=0)return}if(void 0==this.editrow){if(this.editcell){if(this.editcell.row==b&&this.editcell.column==c)return!0;if("selectedrow"===this.editmode&&this.editcell.row==b)return;var h=this.endcelledit(this.editcell.row,this.editcell.column,!1,!0,!1);if(0==h)return}var i="checkbox"==g.columntype||"button"==g.columntype||g.createwidget;if(this.host.removeClass("jqx-disableselect"),this.content.removeClass("jqx-disableselect"),g.editable){if(g.cellbeginedit){var j=this.getcell(b,c),k=g.cellbeginedit(b,c,g.columntype,null!=j?j.value:null);if(0==k)return}var l=this.getrowvisibleindex(b);if(this.editcell=this.getcell(b,c),this.editcell&&(this.editcell.visiblerowindex=l,!this.editcell.editing)){if(i||(this.editcell.editing=!0),this.editcell.columntype=g.columntype,this.editcell.defaultvalue=d,void 0!=g.defaultvalue&&(this.editcell.defaultvalue=g.defaultvalue),this.editcell.init=!0,"checkbox"!=g.columntype&&"selectedrow"!=this.editmode){var m=this.getrowdata(b);this._raiseEvent(17,{rowindex:b,row:m,datafield:g.datafield,value:this.editcell.value,columntype:g.columntype})}if(a.data(document.body,"jqxgrid.edit",this.element.id),!i){var n=this.getrowvisibleindex(b);e!==!1&&(this.autorowheight||this.ensurecellvisible(n,g.datafield)),f!==!1&&this._renderrows(this.virtualsizeinfo)}if(this.editcell)return this.editcell.init=!1,!0}}else{if(!this.editcell)return;this.editcell.editor=null,this.editcell.editing=!1,f!==!1&&this._renderrows(this.virtualsizeinfo),this.editcell=null}}}},getScrollTop:function(){if(this._py)return pageYOffset;if(this._py="undefined"!=typeof pageYOffset,this._py)return pageYOffset;var a=document.body,b=document.documentElement;return b=b.clientHeight?b:a,b.scrollTop},getScrollLeft:function(){if("undefined"!=typeof pageXOffset)return pageXOffset;var a=document.body,b=document.documentElement;return b=b.clientHeight?b:a,b.scrollLeft},endcelledit:function(b,c,d,e,f){if(void 0!=b&&void 0!=c||(this.editcell&&(b=this.editcell.row,c=this.editcell.column),void 0==d&&(d=!0)),this.editcell){var g=this.getcolumn(c),h=this;if("selectedrow"===h.editmode)return void this.endrowedit(b,d);var i=function(){if(0!=f){if(h.isTouchDevice())return;if(!h.isNestedGrid){var a=h.getScrollTop(),b=h.getScrollLeft();try{h.element.focus(),h.content.focus(),a!=h.getScrollTop()&&window.scrollTo(b,a),setTimeout(function(){h.element.focus(),h.content.focus(),a!=h.getScrollTop()&&window.scrollTo(b,a)},10)}catch(a){}}}};if("checkbox"==g.columntype||"button"==g.columntype||g.createwidget)return this.editcell&&(this.editcell.editor=null,this.editcell.editing=!1,this.editcell=null),!0;var j=this._geteditorvalue(g),k=function(a){if(a._hidecelleditor(),g.cellendedit&&g.cellendedit(b,c,g.columntype,a.editcell.value,j),a.editchar=null,g.displayfield!=g.datafield){var d=a.getcellvalue(a.editcell.row,g.displayfield),f=a.editcell.value;oldvalue={value:f,label:d}}else oldvalue=a.editcell.value;var h=a.getrowdata(b);a._raiseEvent(18,{rowindex:b,row:h,datafield:c,displayfield:g.displayfield,oldvalue:j,value:j,columntype:g.columntype}),a.editcell.editor=null,a.editcell.editing=!1,a.editcell=null,(e||void 0==e)&&a._renderrows(a.virtualsizeinfo),i(),a.enablebrowserselection||(a.host.addClass("jqx-disableselect"),a.content.addClass("jqx-disableselect"))};if(d)return k(this),!1;if(this.validationpopup&&(this.validationpopup.hide(),this.validationpopuparrow.hide()),g.cellvaluechanging){var l=g.cellvaluechanging(b,c,g.columntype,this.editcell.value,j);void 0!=l&&(j=l)}if(g.validation){var m=this.getcell(b,c);try{var n=g.validation(m,j),o=this.gridlocalization.validationstring;void 0!=n.message&&(o=n.message);var p="boolean"==typeof n?n:n.result;if(!p)return void 0!=n.showmessage&&1!=n.showmessage||this._showvalidationpopup(b,c,o),this.editcell.validated=!1,!1}catch(a){return this._showvalidationpopup(b,c,this.gridlocalization.validationstring),this.editcell.validated=!1,!1}}if(g.displayfield!=g.datafield){var q=this.getcellvalue(this.editcell.row,g.displayfield),r=this.editcell.value;oldvalue={value:r,label:q}}else oldvalue=this.editcell.value;var s=this.getrowdata(b);if(g.cellendedit){var t=g.cellendedit(b,c,g.columntype,this.editcell.value,j);if(0==t)return this._raiseEvent(18,{rowindex:b,row:s,datafield:c,displayfield:g.displayfield,oldvalue:oldvalue,value:oldvalue,columntype:g.columntype}),k(this),!1}return this._raiseEvent(18,{rowindex:b,row:s,datafield:c,displayfield:g.displayfield,oldvalue:oldvalue,value:j,columntype:g.columntype}),this._hidecelleditor(!1),void 0!=this.editcell&&(this.editcell.editor=null,this.editcell.editing=!1),this.editcell=null,this.editchar=null,this.setcellvalue(b,c,j,e),this.enablebrowserselection||(this.host.addClass("jqx-disableselect"),this.content.addClass("jqx-disableselect")),a.jqx.browser.msie||i(),a.data(document.body,"jqxgrid.edit",""),!0}},beginrowedit:function(b){var c=this;c._oldselectedrow=b,this._cellscache=new Array;var d=!1;if("selectedrow"!=this.editmode&&(d=!0),d){var e=this.editmode;this.editmode="selectedrow"}var f=null;a.each(this.columns.records,function(a,d){if(c.editable&&this.editable){if("checkbox"===this.columntype||"custom"===this.columntype||"widget"===this.columntype||"template"===this.columntype||"button"===this.columntype)return!0;f||(f=this.datafield);var e=c.getcell(b,this.datafield);c.begincelledit(b,this.datafield,null,!1,!1);var g=c.getrowdata(b);c._raiseEvent(17,{rowindex:b,row:g,datafield:this.datafield,value:e.value,columntype:this.columntype})}}),c.editcell&&(c.editcell.init=!0),this._renderrows(this.virtualsizeinfo),d&&(this.editmode=e),f&&c.editcell&&setTimeout(function(){if(c.editcell){var a=c.editcell[f].editor;a&&(a.data().jqxWidget&&a.data().jqxWidget.focus?a.data().jqxWidget.focus():a.focus())}},25)},endrowedit:function(b,c){var d=this;if(this._currentEditableColumn=0,this._focusedColumn=null,this._currentColumn=null,this._checkboxCells=[],!this.editcell)return!1;if(void 0==this.editcell.editor&&"checkbox"!==this.editcell.columntype)return!1;var e=!1;if("selectedrow"!=this.editmode&&(e=!0),e){var f=this.editmode;this.editmode="selectedrow"}var g=!1,h={};this.validationpopup&&(this.validationpopup.hide(),this.validationpopuparrow.hide());for(var i=0;i<this.columns.records.length;i++){var j=this.columns.records[i];if(j.editable&&!j.hidden&&"checkbox"!=j.columntype&&!j.createwidget){var k=this._geteditorvalue(j),l=function(a){a._hidecelleditor();var c=a.getcellvalue(a.editcell.row,j.displayfield);if(j.cellendedit&&j.cellendedit(b,o,j.columntype,c,k),a.editchar=null,j.displayfield!=j.datafield){var d=a.getcellvalue(a.editcell.row,j.displayfield),e=c;m={value:e,label:d}}else m=c;var f=a.getrowdata(b);a._raiseEvent(18,{rowindex:b,row:f,datafield:o,displayfield:j.displayfield,oldvalue:c,value:c,columntype:j.columntype}),a.editcell.editing=!1};if(c)l(this);else{if(j.cellvaluechanging){var m=this.getcellvalue(this.editcell.row,j.displayfield),n=j.cellvaluechanging(b,o,j.columntype,m,k);void 0!=n&&(k=n)}var o=j.datafield;if(j.validation){var p=this.getcell(b,j.datafield);try{var q=j.validation(p,k),r=this.gridlocalization.validationstring;void 0!=q.message&&(r=q.message);var s="boolean"==typeof q?q:q.result;if(!s){void 0!=q.showmessage&&1!=q.showmessage||this._showvalidationpopup(b,o,r),g=!0,this.editcell[j.datafield].validated=!1;continue}}catch(a){this._showvalidationpopup(b,o,this.gridlocalization.validationstring),this.editcell[j.datafield].validated=!1,g=!0;continue}}if(j.displayfield!=j.datafield){var t=this.getcellvalue(this.editcell.row,j.displayfield),u=this.editcell.value;m={value:u,label:t}}else m=this.getcellvalue(this.editcell.row,j.displayfield);h[j.datafield]={newvalue:k,oldvalue:m}}}}var v={},w={};if(!g){this._hidecelleditor(!1);for(var i=0;i<this.columns.records.length;i++){var j=this.columns.records[i],o=j.datafield;if(!j.hidden&&j.editable){var x=this.getrowdata(b);if(!j.createwidget)if("checkbox"!=j.columntype){if(h[j.datafield]){var k=h[j.datafield].newvalue,m=h[j.datafield].oldvalue;if(j.cellendedit){var y=j.cellendedit(b,o,j.columntype,m,k);if(0==y){this._raiseEvent(18,{rowindex:b,row:x,datafield:o,displayfield:j.displayfield,oldvalue:m,value:m,columntype:j.columntype}),l(this);continue}}this.source.updaterow||this._raiseEvent(18,{rowindex:b,row:x,datafield:j.datafield,displayfield:j.displayfield,oldvalue:m,value:k,columntype:j.columntype}),v[j.datafield]=k,w[j.datafield]=m}}else{var k=this.getcellvalue(b,j.displayfield);this._raiseEvent(18,{rowindex:b,row:x,datafield:j.datafield,displayfield:j.displayfield,oldvalue:k,value:k,columntype:j.columntype})}}}var z=this.getrowid(b),x=this.getrowdata(b);if(a.each(v,function(a,b){if(b&&void 0!=b.label){var c=d.getcolumn(a);x[c.displayfield]=b.label,x[c.datafield]=b.value}else x[a]=b}),this.enablebrowserselection||(this.host.addClass("jqx-disableselect"),this.content.addClass("jqx-disableselect")),a.data(document.body,"jqxgrid.edit",""),this.editcell=null,this.editchar=null,this.source.updaterow&&!c){var A=!1,d=this,s=function(c){var e=d.source.updaterow;d.source.updaterow=null,0==c?(a.each(w,function(a,b){if(b&&void 0!=b.label){var c=d.getcolumn(a);x[c.displayfield]=b.label,x[c.datafield]=b.value}else x[a]=b}),d.updaterow(z,x)):d.updaterow(z,x);for(var f=0;f<d.columns.records.length;f++){var g=d.columns.records[f];g.datafield;d._raiseEvent(18,{rowindex:b,datafield:g.datafield,row:x,displayfield:g.displayfield,oldvalue:w[g.datafield],value:x[g.displayfield],columntype:g.columntype})}d.source.updaterow=e};try{A=this.source.updaterow(z,x,s),void 0==A&&(A=!0)}catch(a){return void(A=!1)}}else c||this.updaterow(z,x),this._renderrows(this.virtualsizeinfo)}return e&&(this.editmode=f),g},_selection:function(a){if("selectionStart"in a[0]){var b=a[0],c=b.selectionEnd-b.selectionStart;return{start:b.selectionStart,end:b.selectionEnd,length:c,text:b.value}}var d=document.selection.createRange();if(null==d)return{start:0,end:b.value.length,length:0};var e=a[0].createTextRange(),f=e.duplicate();e.moveToBookmark(d.getBookmark()),f.setEndPoint("EndToStart",e);var c=d.text.length;return{start:f.text.length,end:f.text.length+d.text.length,length:c,text:d.text}},_setSelection:function(a,b,c){if("selectionStart"in c[0])c[0].focus(),c[0].setSelectionRange(a,b);else{var d=c[0].createTextRange();d.collapse(!0),d.moveEnd("character",b),d.moveStart("character",a),d.select()}},findRecordIndex:function(a,b,c){var c=c;if(b)for(var d=c.length,e=0;e<d;e++){var f=c[e],g=f.label;if(a==g)return e}return-1},_destroyeditors:function(){var b=this;this.columns.records&&(a.each(this.columns.records,function(c,d){var e=a.trim(this.datafield).split(" ").join("");switch(this.columntype){case"dropdownlist":var f=b.editors["dropdownlist_"+e];f&&(f.jqxDropDownList("destroy"),b.editors["dropdownlist_"+e]=null);break;case"combobox":var g=b.editors["combobox_"+e];g&&(g.jqxComboBox("destroy"),b.editors["combobox_"+e]=null);break;case"datetimeinput":var h=b.editors["datetimeinput_"+this.datafield];h&&(h.jqxDateTimeInput("destroy"),b.editors["datetimeinput_"+e]=null);break;case"numberinput":var i=b.editors["numberinput_"+e];i&&(i.jqxNumberInput("destroy"),b.editors["numberinput_"+e]=null);break;case"custom":case"template":if(b.destroyeditor&&b.editors["templateeditor_"+e]&&(b.destroyeditor(b.editors["templateeditor_"+e]),b.editors["templateeditor_"+e]=null),b.destroyeditor)for(var j=b.getrows.length(),k=0;k<j;k++)b.editors["customeditor_"+e+"_"+k]&&(b.destroyeditor(b.editors["customeditor_"+e+"_"+k],k),b.editors["customeditor_"+e+"_"+k]=null);break;case"textbox":default:var l=b.editors["textboxeditor_"+e];l&&(b.removeHandler(l,"keydown"),b.editors["textbox_"+e]=null)}}),b.editors=new Array)},_showcelleditor:function(b,c,d,e,f){if(void 0!=d&&null!=this.editcell){if("checkbox"==c.columntype&&c.editable)return void("selectedrow"==this.editmode&&(this._checkboxCells||(this._checkboxCells=[]),this._checkboxCells[c.datafield]=d));void 0==f&&(f=!0),"selectedrow"==this.editmode&&(this.editchar="",f=!1);var g=c.datafield,h=a(d),i=this,j=this.editcell.editor,k=this.getcellvalue(b,g),l=this.getcelltext(b,g),m=this.hScrollInstance,n=m.value,o=parseInt(n);this.columns.records.indexOf(c);if(this.editcell.element=d,0==this.editcell.validated){var p="";this.validationpopup&&(p=this.validationpopup.text()),this._showvalidationpopup(b,g,p)}var q=function(a){i.hScrollInstance.isScrolling()||i.vScrollInstance.isScrolling()||f&&(i.isTouchDevice()||(a&&a.focus(),0!=i.gridcontent[0].scrollTop&&(i.scrolltop(Math.abs(i.gridcontent[0].scrollTop)),i.gridcontent[0].scrollTop=0),0!=i.gridcontent[0].scrollLeft&&(i.gridcontent[0].scrollLeft=0)))};switch(c.columntype){case"dropdownlist":if(this.host.jqxDropDownList){d.innerHTML="";var r=a.trim(c.datafield).split(" ").join(""),s=a.trim(c.displayfield).split(" ").join("");r.indexOf(".")!=-1&&(r=r.replace(".","")),s.indexOf(".")!=-1&&(s=s.replace(".",""));var t=this.editors["dropdownlist_"+r];if(j=void 0==t?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 799; top: 0px; left: 0px; position: absolute;' id='dropdownlisteditor'></div>"):t,j.css("top",a(d).parent().position().top),this.oldhscroll?j.css("left",-o+parseInt(a(d).position().left)):j.css("left",parseInt(a(d).position().left)),c.pinned&&j.css("left",o+parseInt(a(d).position().left)),void 0==t){j.prependTo(this.table),j[0].id="dropdownlisteditor"+this.element.id+r;var u=!!this.source._source,v=null;if(u){var w={localdata:this.source.records,datatype:this.source.datatype,async:!1};v=new a.jqx.dataAdapter(w,{autoBind:!1,async:!1,uniqueDataFields:[s],autoSort:!0,autoSortField:s})}else v=new a.jqx.dataAdapter(this.source,{autoBind:!1,uniqueDataFields:[s],async:!1,autoSort:!0,autoSortField:s});var x=!c.createeditor;j.jqxDropDownList({enableBrowserBoundsDetection:!0,keyboardSelection:!1,source:v,rtl:this.rtl,autoDropDownHeight:x,theme:this.theme,width:h.width()-2,height:h.height()-2,displayMember:s,valueMember:g}),this.editors["dropdownlist_"+r]=j,c.createeditor&&c.createeditor(b,k,j)}c._requirewidthupdate&&j.jqxDropDownList({width:h.width()-2});var y=j.jqxDropDownList("listBox").visibleItems;c.createeditor||(y.length<8?j.jqxDropDownList("autoDropDownHeight",!0):j.jqxDropDownList("autoDropDownHeight",!1));var k=this.getcellvalue(b,s),z=this.findRecordIndex(k,s,y);if(e&&(""!=k?j.jqxDropDownList("selectIndex",z,!0):j.jqxDropDownList("selectIndex",-1)),!this.editcell)return;void 0!=this.editcell.defaultvalue&&j.jqxDropDownList("selectIndex",this.editcell.defaultvalue,!0),f&&j.jqxDropDownList("focus")}break;case"combobox":if(this.host.jqxComboBox){d.innerHTML="";var r=a.trim(c.datafield).split(" ").join(""),s=a.trim(c.displayfield).split(" ").join("");r.indexOf(".")!=-1&&(r=r.replace(".","")),s.indexOf(".")!=-1&&(s=s.replace(".",""));var A=this.editors["combobox_"+r];if(j=void 0==A?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 799; top: 0px; left: 0px; position: absolute;' id='comboboxeditor'></div>"):A,j.css("top",a(d).parent().position().top),this.oldhscroll?j.css("left",-o+parseInt(a(d).position().left)):j.css("left",parseInt(a(d).position().left)),c.pinned&&j.css("left",o+parseInt(a(d).position().left)),void 0==A){j.prependTo(this.table),j[0].id="comboboxeditor"+this.element.id+r;var u=!!this.source._source,v=null;if(u){var w={localdata:this.source.records,datatype:this.source.datatype,async:!1};v=new a.jqx.dataAdapter(w,{autoBind:!1,async:!1,uniqueDataFields:[s],autoSort:!0,autoSortField:s})}else v=new a.jqx.dataAdapter(this.source,{autoBind:!1,uniqueDataFields:[s],async:!1,autoSort:!0,autoSortField:s});var x=!c.createeditor;j.jqxComboBox({enableBrowserBoundsDetection:!0,keyboardSelection:!1,source:v,rtl:this.rtl,autoDropDownHeight:x,theme:this.theme,width:h.width()-2,height:h.height()-2,displayMember:s,valueMember:g}),j.removeAttr("tabindex"),j.find("div").removeAttr("tabindex"),this.editors["combobox_"+r]=j,c.createeditor&&c.createeditor(b,k,j)}c._requirewidthupdate&&j.jqxComboBox({width:h.width()-2});var y=j.jqxComboBox("listBox").visibleItems;c.createeditor||(y.length<8?j.jqxComboBox("autoDropDownHeight",!0):j.jqxComboBox("autoDropDownHeight",!1));var k=this.getcellvalue(b,s),z=this.findRecordIndex(k,s,y);if(e&&(""!=k?(j.jqxComboBox("selectIndex",z,!0),j.jqxComboBox("val",k)):(j.jqxComboBox("selectIndex",-1),j.jqxComboBox("val",k))),!this.editcell)return;void 0!=this.editcell.defaultvalue&&j.jqxComboBox("selectIndex",this.editcell.defaultvalue,!0),this.editchar&&this.editchar.length>0&&j.jqxComboBox("input").val(this.editchar),f&&setTimeout(function(){if(q(j.jqxComboBox("input")),j)if(j.jqxComboBox("_setSelection",0,0),i.editchar)j.jqxComboBox("_setSelection",1,1),i.editchar=null;else if(j.jqxComboBox("input")){var a=j.jqxComboBox("input").val();j.jqxComboBox("_setSelection",0,a.length)}},10)}break;case"datetimeinput":if(this.host.jqxDateTimeInput){d.innerHTML="";var r=a.trim(c.datafield).split(" ").join("");r.indexOf(".")!=-1&&(r=r.replace(".",""));var B=this.editors["datetimeinput_"+r];if(j=void 0==B?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 799; top: 0px; left: 0px; position: absolute;' id='datetimeeditor'></div>"):B,j.show(),j.css("top",a(d).parent().position().top),this.oldhscroll?j.css("left",-o+parseInt(a(d).position().left)):j.css("left",parseInt(a(d).position().left)),c.pinned&&j.css("left",o+parseInt(a(d).position().left)),void 0==B){j.prependTo(this.table),j[0].id="datetimeeditor"+this.element.id+r;var C={calendar:this.gridlocalization};j.jqxDateTimeInput({firstDayOfWeek:this.gridlocalization.firstDay,enableBrowserBoundsDetection:!0,localization:C,_editor:!0,theme:this.theme,rtl:this.rtl,width:h.width(),height:h.height(),formatString:c.cellsformat}),this.editors["datetimeinput_"+r]=j,c.createeditor&&c.createeditor(b,k,j)}if(c._requirewidthupdate&&j.jqxDateTimeInput({width:h.width()-2}),e){if(""!=k&&null!=k){var D=new Date(k);"Invalid Date"==D&&this.source.getvaluebytype&&(D=this.source.getvaluebytype(k,{name:c.datafield,type:"date"})),j.jqxDateTimeInput("setDate",D)}else j.jqxDateTimeInput("setDate",null);void 0!=this.editcell.defaultvalue&&j.jqxDateTimeInput("setDate",this.editcell.defaultvalue)}if(f){var E=this.editEvent;setTimeout(function(){q(j.jqxDateTimeInput("dateTimeInput")),setTimeout(function(){if(j.jqxDateTimeInput("_selectGroup",0),i.editchar&&i.editchar.length>0){var a=parseInt(i.editchar);if(!isNaN(a)&&E){var b=E.charCode?E.charCode:E.keyCode?E.keyCode:0;j.jqxDateTimeInput("_handleKeyPress",E,b)}}},25)},10)}}break;case"numberinput":if(this.host.jqxNumberInput){d.innerHTML="";var r=a.trim(c.datafield).split(" ").join("");r.indexOf(".")!=-1&&(r=r.replace(".",""));var F=this.editors["numberinput_"+r];if(j=void 0==F?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 799; top: 0px; left: 0px; position: absolute;' id='numbereditor'></div>"):F,j.show(),j.css("top",a(d).parent().position().top),this.oldhscroll?j.css("left",-o+parseInt(a(d).position().left)):j.css("left",parseInt(a(d).position().left)),c.pinned&&j.css("left",o+parseInt(a(d).position().left)),void 0==F){j.prependTo(this.table),j[0].id="numbereditor"+this.element.id+r;var G="",H="left",I=2;c.cellsformat?c.cellsformat.indexOf("c")!=-1?(G=this.gridlocalization.currencysymbol,H=this.gridlocalization.currencysymbolposition,H="before"==H?"left":"right",c.cellsformat.length>1&&(I=parseInt(c.cellsformat.substring(1),10))):c.cellsformat.indexOf("p")!=-1&&(G=this.gridlocalization.percentsymbol,H="right",c.cellsformat.length>1&&(I=parseInt(c.cellsformat.substring(1),10))):I=0,j.jqxNumberInput({decimalSeparator:this.gridlocalization.decimalseparator,decimalDigits:I,inputMode:"simple",theme:this.theme,rtl:this.rtl,width:h.width()-1,height:h.height()-1,spinButtons:!0,symbol:G,symbolPosition:H}),this.editors["numberinput_"+r]=j,c.createeditor&&c.createeditor(b,k,j)}if(c._requirewidthupdate&&j.jqxNumberInput({width:h.width()-2}),e){if(""!=k&&null!=k){var J=k;j.jqxNumberInput("setDecimal",J)}else j.jqxNumberInput("setDecimal",0);if(void 0!=this.editcell.defaultvalue&&j.jqxNumberInput("setDecimal",this.editcell.defaultvalue),this.editchar&&this.editchar.length>0){var K=parseInt(this.editchar);isNaN(K)||j.jqxNumberInput("setDecimal",K)}f&&setTimeout(function(){
7 if(q(j.jqxNumberInput("numberInput")),j.jqxNumberInput("_setSelectionStart",0),i.editchar)c.cellsformat.length>0?j.jqxNumberInput("_setSelectionStart",2):j.jqxNumberInput("_setSelectionStart",1),i.editchar=null;else{var a=j.jqxNumberInput("spinButtons");if(a){var b=j.jqxNumberInput("numberInput").val();i._setSelection(j.jqxNumberInput("numberInput")[0],b.length,b.length)}else{var b=j.jqxNumberInput("numberInput").val();i._setSelection(j.jqxNumberInput("numberInput")[0],0,b.length)}j.jqxNumberInput("selectAll")}},10)}}break;case"custom":d.innerHTML="";var r=a.trim(c.datafield).split(" ").join("");r.indexOf(".")!=-1&&(r=r.replace(".",""));var L=this.editors["customeditor_"+r+"_"+b];if(j=void 0==L?a("<div style='overflow: hidden; border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 799; top: 0px; left: 0px; position: absolute;' id='customeditor'></div>"):L,j.show(),j.css("top",a(d).parent().position().top),this.oldhscroll?j.css("left",-o+parseInt(a(d).position().left)):j.css("left",parseInt(a(d).position().left)),c.pinned&&j.css("left",o+parseInt(a(d).position().left)),void 0==L){j.prependTo(this.table),j[0].id="customeditor"+this.element.id+r+"_"+b,this.editors["customeditor_"+r+"_"+b]=j;var M=h.width()-1,N=h.height()-1;j.width(M),j.height(N),c.createeditor&&c.createeditor(b,k,j,l,M,N,this.editchar)}c._requirewidthupdate&&j.width(h.width()-2);break;case"template":d.innerHTML="";var r=a.trim(c.datafield).split(" ").join("");r.indexOf(".")!=-1&&(r=r.replace(".",""));var O=this.editors["templateeditor_"+r];if(j=void 0==O?a("<div style='overflow: hidden; border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 799; top: 0px; left: 0px; position: absolute;' id='templateeditor'></div>"):O,j.show(),j.css("top",a(d).parent().position().top),this.oldhscroll?j.css("left",-o+parseInt(a(d).position().left)):j.css("left",parseInt(a(d).position().left)),c.pinned&&j.css("left",o+parseInt(a(d).position().left)),void 0==O){j.prependTo(this.table),j[0].id="templateeditor"+this.element.id+r,this.editors["templateeditor_"+r]=j;var M=h.width()-1,N=h.height()-1;j.width(M),j.height(N),c.createeditor&&c.createeditor(b,k,j,l,M,N,this.editchar)}c._requirewidthupdate&&j.width(h.width()-2);break;case"textbox":default:d.innerHTML="",j=this.editors["textboxeditor_"+c.datafield]||a("<input autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' type='textbox' id='textboxeditor'/>"),j[0].id="textboxeditor"+this.element.id+c.datafield,j.appendTo(h),this.rtl&&j.css("direction","rtl"),(e||""==j[0].className)&&(j.addClass(this.toThemeProperty("jqx-input")),j.addClass(this.toThemeProperty("jqx-widget-content")),this.editchar&&this.editchar.length>0?j.val(this.editchar):(""!=c.cellsformat&&(k=this.getcelltext(b,g)),void 0==k&&(k=""),j.val(k)),void 0!=this.editcell.defaultvalue&&j.val(this.editcell.defaultvalue),j.width(h.width()+1),j.height(h.height()+1),c.createeditor&&c.createeditor(b,k,j),""!=c.cellsformat&&(c.cellsformat.indexOf("p")==-1&&c.cellsformat.indexOf("c")==-1&&c.cellsformat.indexOf("n")==-1&&c.cellsformat.indexOf("f")==-1||this.editors["textboxeditor_"+c.datafield]||j.keydown(function(a){var b=a.charCode?a.charCode:a.keyCode?a.keyCode:0,d=String.fromCharCode(b),e=parseInt(d);if(isNaN(e))return!0;if(i._selection(j).length>0)return!0;var f="",g=j.val();if(c.cellsformat.length>1){var h=parseInt(c.cellsformat.substring(1));isNaN(h)&&(h=0)}else var h=0;if(h>0&&g.indexOf(i.gridlocalization.decimalseparator)!=-1&&i._selection(j).start>g.indexOf(i.gridlocalization.decimalseparator))return!0;for(var k=0;k<g.length-h;k++){var l=g.substring(k,k+1);null!=l.match(/^[0-9]+$/)&&(f+=l)}return!(f.length>=11)&&void 0}))),this.editors["textboxeditor_"+c.datafield]=j,e&&f&&setTimeout(function(){q(j),i.editchar?(i._setSelection(j[0],1,1),i.editchar=null):i._setSelection(j[0],0,j.val().length)},25)}j&&(j[0].style.zIndex=1+parseInt(d.style.zIndex),a.jqx.browser.msie&&a.jqx.browser.version<8&&(j[0].style.zIndex=1+this.columns.records.length+d.style.zIndex),j.css("display","block"),this.editcell.editor=j,this.editcell[g]?this.editcell[g].editor=j:(this.editcell[g]={},this.editcell[g].editor=j)),e&&c.initeditor&&c.initeditor(b,k,j,l,this.editchar),i.isTouchDevice()||setTimeout(function(){i.content&&(i.content[0].scrollTop=0,i.content[0].scrollLeft=0),i.gridcontent&&(i.gridcontent[0].scrollLeft=0,i.gridcontent[0].scrollTop=0)},10)}},_setSelection:function(a,b,c){try{if("selectionStart"in a)a.setSelectionRange(b,c);else{var d=a.createTextRange();d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d.select()}}catch(a){}},_hideeditors:function(){if(null!=this.editcells){var a=this;for(var b in this.editcells)a.editcell=a.editcells[b],a._hidecelleditor()}},_hidecelleditor:function(a){if(this.editcell){if("selectedrow"===this.editmode){for(var b=0;b<this.columns.records.length;b++){var c=this.columns.records[b];if(this.editcell[c.datafield]&&this.editcell[c.datafield].editor){this.editcell[c.datafield].editor.hide();var d=this.editcell[c.datafield].editor;switch(c.columntype){case"dropdownlist":d.jqxDropDownList({closeDelay:0}),d.jqxDropDownList("hideListBox"),d.jqxDropDownList({closeDelay:300});break;case"combobox":d.jqxComboBox({closeDelay:0}),d.jqxComboBox("hideListBox"),d.jqxComboBox({closeDelay:300});break;case"datetimeinput":d.jqxDateTimeInput("isOpened")&&(d.jqxDateTimeInput({closeDelay:0}),d.jqxDateTimeInput("hideCalendar"),d.jqxDateTimeInput({closeDelay:300}))}}}return void(this.validationpopup&&(this.validationpopup.hide(),this.validationpopuparrow.hide()))}if("checkbox"!=this.editcell.columntype){if(this.editcell.editor)switch(this.editcell.editor.hide(),this.editcell.columntype){case"dropdownlist":this.editcell.editor.jqxDropDownList({closeDelay:0}),this.editcell.editor.jqxDropDownList("hideListBox"),this.editcell.editor.jqxDropDownList({closeDelay:300});break;case"combobox":this.editcell.editor.jqxComboBox({closeDelay:0}),this.editcell.editor.jqxComboBox("hideListBox"),this.editcell.editor.jqxComboBox({closeDelay:300});break;case"datetimeinput":var e=this.editcell.editor;e.jqxDateTimeInput("isOpened")&&(e.jqxDateTimeInput({closeDelay:0}),e.jqxDateTimeInput("hideCalendar"),e.jqxDateTimeInput({closeDelay:300}))}this.validationpopup&&(this.validationpopup.hide(),this.validationpopuparrow.hide()),this.isNestedGrid||0!=a&&this.element.focus()}}},_geteditorvalue:function(b){var c=new String;if(!this.editcell)return null;var d=this.editcell.editor;if("selectedrow"==this.editmode&&this.editcell[b.datafield])var d=this.editcell[b.datafield].editor;if(d){switch(b.columntype){case"textbox":default:if(c=d.val(),""!=b.cellsformat){var e="string",f=this.source.datafields||(this.source._source?this.source._source.datafields:null);if(f){var g="";a.each(f,function(){if(this.name==b.displayfield)return this.type&&(g=this.type),!1}),g&&(e=g)}var h="number"===e||"float"===e||"int"===e||"integer"===e,i="date"===e||"time"===e;if(h||"string"===e&&(b.cellsformat.indexOf("p")!=-1||b.cellsformat.indexOf("c")!=-1||b.cellsformat.indexOf("n")!=-1||b.cellsformat.indexOf("f")!=-1)){if(""===c&&b.nullable)return"";c.indexOf(this.gridlocalization.currencysymbol)>-1&&(c=c.replace(this.gridlocalization.currencysymbol,""));var j=function(a,b,c){var d=a;if(b==c)return a;for(var e=d.indexOf(b);e!=-1;)d=d.replace(b,c),e=d.indexOf(b);return d},k=c;if(k=new Number(k),!isNaN(k))return k;c=j(c,this.gridlocalization.thousandsseparator,""),c=c.replace(this.gridlocalization.decimalseparator,"."),c.indexOf(this.gridlocalization.percentsymbol)>-1&&(c=c.replace(this.gridlocalization.percentsymbol,""));for(var l="",m=0;m<c.length;m++){var n=c.substring(m,m+1);"-"===n&&(l+="-"),"."===n&&(l+="."),null!=n.match(/^[0-9]+$/)&&(l+=n)}c=l,c=c.replace(/ /g,""),c=new Number(c),isNaN(c)&&(c="")}if(i||"string"===e&&(b.cellsformat.indexOf("H")!=-1||b.cellsformat.indexOf("m")!=-1||b.cellsformat.indexOf("M")!=-1||b.cellsformat.indexOf("y")!=-1||b.cellsformat.indexOf("h")!=-1||b.cellsformat.indexOf("d")!=-1)){if(""===c&&b.nullable)return"";var o=c;a.jqx.dataFormat&&(c=a.jqx.dataFormat.tryparsedate(o,this.gridlocalization)),"Invalid Date"!=c&&null!=c||(c="")}}b.displayfield!=b.datafield&&(c={label:c,value:c});break;case"checkbox":d.jqxCheckBox&&(c=d.jqxCheckBox("checked"));break;case"datetimeinput":if(d.jqxDateTimeInput){if(d.jqxDateTimeInput({isEditing:!1}),d.jqxDateTimeInput("_validateValue"),c=d.jqxDateTimeInput("getDate"),null==c)return null;c=new Date(c.toString()),b.displayfield!=b.datafield&&(c={label:c,value:c})}break;case"dropdownlist":if(d.jqxDropDownList){var p=d.jqxDropDownList("selectedIndex"),q=d.jqxDropDownList("listBox").getVisibleItem(p);c=b.displayfield!=b.datafield?q?{label:q.label,value:q.value}:"":q?q.label:"",null==c&&(c="")}break;case"combobox":if(d.jqxComboBox){if(c=d.jqxComboBox("val"),b.displayfield!=b.datafield){var q=d.jqxComboBox("getSelectedItem");null!=q&&(c={label:q.label,value:q.value})}null==c&&(c="")}break;case"numberinput":if(d.jqxNumberInput){this.touchdevice&&d.jqxNumberInput("_doTouchHandling");var r=d.jqxNumberInput("getDecimal");c=new Number(r),c=parseFloat(c),isNaN(c)&&(c=0),null===r&&(c=null),b.displayfield!=b.datafield&&(c={label:c,value:c})}}b.geteditorvalue&&(c="selectedrow"==this.editmode?b.geteditorvalue(this.editcell.row,this.getcellvalue(this.editcell.row,b.datafield),d):b.geteditorvalue(this.editcell.row,this.editcell.value,d))}return c},hidevalidationpopups:function(){this.popups&&(a.each(this.popups,function(){this.validation.remove(),this.validationrow.remove()}),this.popups=new Array),this.validationpopup&&(this.validationpopuparrow.hide(),this.validationpopup.hide())},showvalidationpopup:function(b,c,d){if(void 0==d)var d=this.gridlocalization.validationstring;var e=a("<div style='z-index: 99999; top: 0px; left: 0px; position: absolute;'></div>"),f=a("<div style='width: 20px; height: 20px; z-index: 999999; top: 0px; left: 0px; position: absolute;'></div>");e.html(d),f.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),f.prependTo(this.table);for(var g=this.hScrollInstance,h=g.value,i=parseInt(h),j=this.getcolumn(c).uielement,k=null,l=0;l<this.hittestinfo.length;l++)b===this.hittestinfo[l].row.visibleindex&&(k=this.hittestinfo[l]);if(!k){this.ensurerowvisible(b);var m=this;return e.remove(),f.remove(),void setTimeout(function(){for(var a=null,e=0;e<m.hittestinfo.length;e++)b===m.hittestinfo[e].row.visibleindex&&(a=m.hittestinfo[e]);a&&m.showvalidationpopup(b,c,d)},25)}var n=a(k.visualrow);e.css("top",parseInt(n.position().top)+30+"px");var o=parseInt(e.css("top"));f.css("top",o-12),f.removeClass(),f.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));var p=!1;o>=this._gettableheight()&&(f.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),f.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),o=parseInt(n.position().top)-this.rowsheight-5,o<0&&(o=0,this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),p=!0),e.css("top",o+"px"),f.css("top",o+e.outerHeight()-9));var q=-i+parseInt(a(j).position().left);f.css("left",i+q+30);var r=e.width();if(r+q>this.host.width()-20){var s=r+q-this.host.width()+40;q-=s}p?e.css("left",i+parseInt(a(j).position().left)-e.outerWidth()):e.css("left",i+q),e.show(),f.show(),this.popups||(this.popups=new Array),this.popups[this.popups.length]={validation:e,validationrow:f}},_showvalidationpopup:function(b,c,d){var e=this.editcell,f=this.editcell.editor;if("selectedrow"==this.editmode){var e=this.editcell[c];e&&e.editor&&(f=e.editor,e.element=f)}if(f&&!(this.validationpopup&&a.jqx.isHidden(this.validationpopup)&&(this.validationpopup.remove&&(this.validationpopup.remove(),this.validationpopuparrow.remove()),this.validationpopup=null,this.validationpopuparrow=null,void 0===c&&void 0===d&&this.editors&&0===this.editors.length))){if(this.validationpopup)this.validationpopup.html(d);else{var g=a("<div style='z-index: 99999; top: 0px; left: 0px; position: absolute;'></div>"),h=a("<div style='width: 20px; height: 20px; z-index: 999999; top: 0px; left: 0px; position: absolute;'></div>");g.html(d),h.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),g.addClass(this.toThemeProperty("jqx-grid-validation")),g.addClass(this.toThemeProperty("jqx-rc-all")),g.prependTo(this.table),h.prependTo(this.table),this.validationpopup=g,this.validationpopuparrow=h}var i=this.hScrollInstance,j=i.value,k=parseInt(j);"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(e.editor).position().top)+(this.rowsheight+5)+"px"):this.validationpopup.css("top",parseInt(a(e.element).parent().position().top)+(this.rowsheight+5)+"px");var l=parseInt(this.validationpopup.css("top"));this.validationpopuparrow.css("top",l-11),this.validationpopuparrow.removeClass(),this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));var m=this._gettableheight(),n=!1;l>=m&&(this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up")),this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),l=parseInt(a(e.element).parent().position().top)-this.rowsheight-5,"selectedrow"==this.editmode&&(l=this.visiblerows&&this.visiblerows[this.editcell.visiblerowindex]?this.visiblerows[this.editcell.visiblerowindex].top-this.rowsheight-5:parseInt(a(e.editor).position().top)-this.rowsheight-5),l<0&&(l=0,this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down")),n=!0),this.validationpopup.css("top",l+"px"),this.validationpopuparrow.css("top",l+this.validationpopup.outerHeight()-9));var o=-k+parseInt(a(e.element).position().left);this.validationpopuparrow.css("left",k+o+30);var p=this.validationpopup.width();if(p+o>this.host.width()-20){var q=p+o-this.host.width()+40;o-=q}n?this.validationpopup.css("left",k+parseInt(a(e.element).position().left)-this.validationpopup.outerWidth()):this.validationpopup.css("left",k+o),"none"==this.editcell.editor.css("display")?(this.validationpopup.hide(),this.validationpopuparrow.hide()):(this.validationpopup.show(),this.validationpopuparrow.show())}}})}(jqxBaseFramework);
6 8
7 (function(a){a.extend(a.jqx._jqxGrid.prototype,{_handledblclick:function(t,n){if(t.target==null){return}if(n.disabled){return}if(a(t.target).ischildof(this.columnsheader)){return}var w;if(t.which){w=(t.which==3)}else{if(t.button){w=(t.button==2)}}if(w){return}var B;if(t.which){B=(t.which==2)}else{if(t.button){B=(t.button==1)}}if(B){return}var v=this.showheader?this.columnsheader.height()+2:0;var o=this._groupsheader()?this.groupsheader.height():0;var A=this.showtoolbar?this.toolbarheight:0;o+=A;var e=this.host.offset();var m=t.pageX-e.left;var l=t.pageY-v-e.top-o;var b=this._hittestrow(m,l);if(!b){return}var h=b.row;var j=b.index;var q=t.target.className;var p=this.table[0].rows[j];if(p==null){return}n.mousecaptured=true;n.mousecaptureposition={left:t.pageX,top:t.pageY-o};var r=this.hScrollInstance;var s=r.value;var d=0;var k=this.groupable?this.groups.length:0;for(var u=0;u<p.cells.length;u++){var f=parseInt(a(this.columnsrow[0].cells[u]).css("left"));var g=f-s;if(n.columns.records[u].pinned){g=f}var c=this._getcolumnat(u);if(c!=null&&c.hidden){continue}var z=g+a(this.columnsrow[0].cells[u]).width();if(z>=m&&m>=g){d=u;break}}if(h!=null){var c=this._getcolumnat(d);if(!(q.indexOf("jqx-grid-group-expand")!=-1||q.indexOf("jqx-grid-group-collapse")!=-1)){if(h.boundindex!=-1){n.begincelledit(n.getboundindex(h),c.datafield,c.defaulteditorvalue)}}}},_getpreveditablecolumn:function(c){var b=this;while(c>0){c--;var d=b.getcolumnat(c);if(!d){return null}if(!d.editable){continue}if(!d.hidden){return d}}return null},_getnexteditablecolumn:function(c){var b=this;while(c<this.columns.records.length){c++;var d=b.getcolumnat(c);if(!d){return null}if(!d.editable){continue}if(!d.hidden){return d}}return null},_handleeditkeydown:function(D,x){if(x.handlekeyboardnavigation){var p=x.handlekeyboardnavigation(D);if(p==true){return true}}var H=D.charCode?D.charCode:D.keyCode?D.keyCode:0;if(x.showfilterrow&&x.filterable){if(this.filterrow){if(a(D.target).ischildof(this.filterrow)){return true}}}if(x.pageable){if(a(D.target).ischildof(this.pager)){return true}}if(this.showtoolbar){if(a(D.target).ischildof(this.toolbar)){return true}}if(this.showeverpresentrow){if(this.addnewrowtop){if(a(D.target).ischildof(this.addnewrowtop)){return true}}if(this.addnewrowbottom){if(a(D.target).ischildof(this.addnewrowbottom)){return true}}}if(this.showstatusbar){if(a(D.target).ischildof(this.statusbar)){return true}}if(this.rowdetails){if(a(D.target).ischildof(this.content.find("[role='rowgroup']"))){return true}}if(this.editcell){if(this.editmode==="selectedrow"){if(H===13){this.endrowedit(this.editcell.row,false)}else{if(H===27){this.endrowedit(this.editcell.row,true)}}if(H===9){return false}return true}if(this.editcell.columntype==null||this.editcell.columntype=="textbox"||this.editcell.columntype=="numberinput"||this.editcell.columntype=="combobox"||this.editcell.columntype=="datetimeinput"){if(H>=33&&H<=40&&x.selectionmode=="multiplecellsadvanced"){var i=this.editcell.columntype=="textbox"||this.editcell.columntype==null?this.editcell.editor:this.editcell.editor.find("input");var I=x._selection(i);var y=i.val().length;if(I.length>0&&this.editcell.columntype!="datetimeinput"){x._cancelkeydown=true}if(I.start>0&&H==37){x._cancelkeydown=true}if(I.start<y&&H==39&&this.editcell.columntype!="datetimeinput"){x._cancelkeydown=true}if(this.editcell.columntype=="datetimeinput"&&H==39){if(I.start+I.length<y){x._cancelkeydown=true}}}}else{if(this.editcell.columntype=="dropdownlist"){if(H==37||H==39&&x.selectionmode=="multiplecellsadvanced"){x._cancelkeydown=false}}else{if(this.selectionmode=="multiplecellsadvanced"&&this.editcell.columntype!="textbox"&&this.editcell.columntype!="numberinput"){x._cancelkeydown=true}}}if(H==32){if(x.editcell.columntype=="checkbox"){var f=x.getcolumn(x.editcell.datafield);if(f.editable){var o=!x.getcellvalue(x.editcell.row,x.editcell.column);if(f.cellbeginedit){var b=f.cellbeginedit(x.editcell.row,f.datafield,f.columntype,!o);if(b==false){return false}}var k=x.getrowdata(x.editcell.row);x.setcellvalue(x.editcell.row,x.editcell.column,o,true);x._raiseEvent(18,{rowindex:x.editcell.row,row:k,datafield:x.editcell.column,oldvalue:!o,value:o,columntype:"checkbox"});return false}}}if(H==9){var h=this.editcell.row;var v=this.editcell.column;var n=v;var A=x._getcolumnindex(v);var u=false;var d=x.getrowvisibleindex(h);this.editchar="";var e=this.editcell.validated;if(!this.editcell.validated){var e=this.endcelledit(this.editcell.row,this.editcell.column,false,true,false)}if(e!=false){if(D.shiftKey){var f=x._getpreveditablecolumn(A);if(f){v=f.datafield;u=true;if(x.selectionmode.indexOf("cell")!=-1){x.selectprevcell(h,n);x._oldselectedcell=x.selectedcell;setTimeout(function(){x.ensurecellvisible(d,v)},10)}}}else{var f=x._getnexteditablecolumn(A);if(f){v=f.datafield;u=true;if(x.selectionmode.indexOf("cell")!=-1){x.selectnextcell(h,n);x._oldselectedcell=x.selectedcell;setTimeout(function(){x.ensurecellvisible(d,v)},10)}}}if(u){x.begincelledit(h,v);if(this.editcell!=null&&this.editcell.columntype=="checkbox"){this._renderrows(this.virtualsizeinfo)}}else{if(this.editcell!=null){x.endcelledit(h,v,false);this._renderrows(this.virtualsizeinfo)}return true}}return false}else{if(H==13){var t=this.selectedcell;if(t){var w=this.getrowvisibleindex(t.rowindex)}this.endcelledit(this.editcell.row,this.editcell.column,false,true);if(this.selectionmode=="multiplecellsadvanced"){var c=x.getselectedcell();if(c!=null){if(x.selectcell){if(this.editcell==null){if(c.rowindex+1<this.dataview.totalrecords){if(this.sortcolumn!=c.datafield){var d=this.getrowvisibleindex(c.rowindex);var G=this.dataview.loadedrecords[d+1];if(G){if(!this.pageable||(this.pageable&&d+1<(this.dataview.pagenum+1)*this.pagesize)){this.clearselection(false);this.selectcell(this.getboundindex(G),c.datafield);var c=this.getselectedcell();this.ensurecellvisible(G.visibleindex,c.datafield)}}}else{if(t!=null){var F=this.dataview.loadedrecords[w+1];if(F){if(!this.pageable||(this.pageable&&w+1<this.pagesize)){this.clearselection(false);this.selectcell(this.getboundindex(F),c.datafield)}else{if(this.pageable&&w+1>=this.pagesize){this.clearselection(false);var F=this.dataview.loadedrecords[w];this.selectcell(this.getboundindex(F),c.datafield)}}}}}}}}}}return false}else{if(H==27){this.endcelledit(this.editcell.row,this.editcell.column,true,true);return false}}}}else{var z=false;if(H==113){z=true}if(!D.ctrlKey&&!D.altKey&&!D.metaKey){if(H>=48&&H<=57){this.editchar=String.fromCharCode(H);z=true}if(H>=65&&H<=90){this.editchar=String.fromCharCode(H);var s=false;if(D.shiftKey){s=D.shiftKey}else{if(D.modifiers){s=!!(D.modifiers&4)}}if(!s){this.editchar=this.editchar.toLowerCase()}z=true}else{if(H>=96&&H<=105){this.editchar=H-96;this.editchar=this.editchar.toString();z=true}}var r=a(".jqx-grid").length;z=z&&(r==1||(r>1&&x.focused));var l=a.data(document.body,"jqxgrid.edit");if(l!==undefined&&l!==""){if(H===13||z){if(l!=x.element.id){return true}}}}if(H==13||z){if(x.getselectedrowindex){var h=x.getselectedrowindex();switch(x.selectionmode){case"singlerow":case"multiplerows":case"multiplerowsextended":if(h>=0){var v="";for(var B=0;B<x.columns.records.length;B++){var f=x.getcolumnat(B);if(f.editable){v=f.datafield;break}}x.begincelledit(h,v)}break;case"singlecell":case"multiplecells":case"multiplecellsextended":var c=x.getselectedcell();if(c!=null){var f=x._getcolumnbydatafield(c.datafield);if(f.columntype!="checkbox"){x.begincelledit(c.rowindex,c.datafield)}}break;case"multiplecellsadvanced":var c=x.getselectedcell();if(c!=null){if(H==13){if(x.selectcell){if(c.rowindex+1<x.dataview.totalrecords){var d=this.getrowvisibleindex(c.rowindex);var G=this.dataview.loadedrecords[d+1];if(G){this.clearselection(false);this.selectcell(this.getboundindex(G),c.datafield);var c=this.getselectedcell();this.ensurecellvisible(G.visibleindex,c.datafield)}}}}else{if(x.editmode!=="selectedrow"){x.begincelledit(c.rowindex,c.datafield)}}}break}return false}}if(H==46){var g=x.getselectedcells();if(x.selectionmode.indexOf("cell")==-1){if(x._getcellsforcopypaste){g=x._getcellsforcopypaste()}}if(g!=null&&g.length>0){for(var q=0;q<g.length;q++){var c=g[q];if(!c.datafield){continue}var f=x.getcolumn(c.datafield);var E=x.getcellvalue(c.rowindex,c.datafield);if(E!==""&&f.editable&&x.enablekeyboarddelete){var j=null;if(f.columntype=="checkbox"){if(!f.threestatecheckbox){j=false}}if(f.cellbeginedit){var b=f.cellbeginedit(c.rowindex,f.datafield,f.columntype,j);if(b==false){return false}}var k=x.getrowdata(c.rowindex);x._raiseEvent(17,{rowindex:c.rowindex,row:k,datafield:c.datafield,value:E});if(q==g.length-1){x.setcellvalue(c.rowindex,c.datafield,j,true);if(f.displayfield!=f.datafield){x.setcellvalue(c.rowindex,f.displayfield,j,true)}}else{x.setcellvalue(c.rowindex,c.datafield,j,false);if(f.displayfield!=f.datafield){x.setcellvalue(c.rowindex,f.displayfield,j,true)}}if(f.cellendedit){var C=f.cellendedit(c.rowindex,f.datafield,f.columntype,j)}x._raiseEvent(18,{rowindex:c.rowindex,row:k,datafield:c.datafield,oldvalue:E,value:j})}}this.dataview.updateview();this._renderrows(this.virtualsizeinfo);return false}}if(H==32){var c=x.getselectedcell();if(c!=null){var f=x.getcolumn(c.datafield);if(f.columntype=="checkbox"&&f.editable){var o=!x.getcellvalue(c.rowindex,c.datafield);if(f.cellbeginedit){var b=f.cellbeginedit(c.rowindex,f.datafield,f.columntype,!o);if(b==false){return false}}var k=x.getrowdata(c.rowindex);x._raiseEvent(17,{rowindex:c.rowindex,row:k,datafield:c.datafield,value:!o,columntype:"checkbox"});x.setcellvalue(c.rowindex,c.datafield,o,true);x._raiseEvent(18,{rowindex:c.rowindex,row:k,datafield:c.datafield,oldvalue:!o,value:o,columntype:"checkbox"});return false}}}}return true},begincelledit:function(n,e,l,g,c){var f=this.getcolumn(e);this._cellscache=new Array();if(e==null){return}if(f.columntype=="number"||f.columntype=="button"){return}if(this.groupable){if(this.groups.indexOf(e)>=0){return}if(this.groups.indexOf(f.displayfield)>=0){return}}if(this.editrow!=undefined){return}if(this.editcell){if(this.editcell.row==n&&this.editcell.column==e){return true}if(this.editmode==="selectedrow"){if(this.editcell.row==n){return}}var d=this.endcelledit(this.editcell.row,this.editcell.column,false,true,false);if(false==d){return}}var i=f.columntype=="checkbox"||f.columntype=="button";this.host.removeClass("jqx-disableselect");this.content.removeClass("jqx-disableselect");if(f.editable){if(f.cellbeginedit){var k=this.getcell(n,e);var m=f.cellbeginedit(n,e,f.columntype,k!=null?k.value:null);if(m==false){return}}var j=this.getrowvisibleindex(n);this.editcell=this.getcell(n,e);if(this.editcell){this.editcell.visiblerowindex=j;if(!this.editcell.editing){if(!i){this.editcell.editing=true}this.editcell.columntype=f.columntype;this.editcell.defaultvalue=l;if(f.defaultvalue!=undefined){this.editcell.defaultvalue=f.defaultvalue}this.editcell.init=true;if(f.columntype!="checkbox"&&this.editmode!="selectedrow"){var h=this.getrowdata(n);this._raiseEvent(17,{rowindex:n,row:h,datafield:f.datafield,value:this.editcell.value,columntype:f.columntype})}a.data(document.body,"jqxgrid.edit",this.element.id);if(!i){var b=this.getrowvisibleindex(n);if(g!==false){this.ensurecellvisible(b,f.datafield)}if(c!==false){this._renderrows(this.virtualsizeinfo)}}if(this.editcell){this.editcell.init=false;return true}}}}else{if(!this.editcell){return}this.editcell.editor=null;this.editcell.editing=false;if(c!==false){this._renderrows(this.virtualsizeinfo)}this.editcell=null}},getScrollTop:function(){if(this._py){return pageYOffset}this._py=typeof pageYOffset!="undefined";if(this._py){return pageYOffset}else{var c=document.body;var b=document.documentElement;b=(b.clientHeight)?b:c;return b.scrollTop}},getScrollLeft:function(){if(typeof pageXOffset!="undefined"){return pageXOffset}else{var c=document.body;var b=document.documentElement;b=(b.clientHeight)?b:c;return b.scrollLeft}},endcelledit:function(h,n,j,e,o){if(h==undefined||n==undefined){if(this.editcell){h=this.editcell.row;n=this.editcell.column}if(j==undefined){j=true}}if(!this.editcell){return}var d=this.getcolumn(n);var u=this;if(u.editmode==="selectedrow"){this.endrowedit(h,j);return}var t=function(){if(o!=false){if(u.isTouchDevice()){return}if(!u.isNestedGrid){var v=u.getScrollTop();var x=u.getScrollLeft();try{u.element.focus();u.content.focus();if(v!=u.getScrollTop()){window.scrollTo(x,v)}setTimeout(function(){u.element.focus();u.content.focus();if(v!=u.getScrollTop()){window.scrollTo(x,v)}},10)}catch(w){}}}};if(d.columntype=="checkbox"||d.columntype=="button"){if(this.editcell){this.editcell.editor=null;this.editcell.editing=false;this.editcell=null}return true}var i=this._geteditorvalue(d);var g=function(w){w._hidecelleditor();if(d.cellendedit){d.cellendedit(h,n,d.columntype,w.editcell.value,i)}w.editchar=null;if(d.displayfield!=d.datafield){var v=w.getcellvalue(w.editcell.row,d.displayfield);var x=w.editcell.value;oldvalue={value:x,label:v}}else{oldvalue=w.editcell.value}var y=w.getrowdata(h);w._raiseEvent(18,{rowindex:h,row:y,datafield:n,displayfield:d.displayfield,oldvalue:i,value:i,columntype:d.columntype});w.editcell.editor=null;w.editcell.editing=false;w.editcell=null;if(e||e==undefined){w._renderrows(w.virtualsizeinfo)}t();if(!w.enablebrowserselection){w.host.addClass("jqx-disableselect");w.content.addClass("jqx-disableselect")}};if(j){g(this);return false}if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}if(d.cellvaluechanging){var b=d.cellvaluechanging(h,n,d.columntype,this.editcell.value,i);if(b!=undefined){i=b}}if(d.validation){var c=this.getcell(h,n);try{var p=d.validation(c,i);var l=this.gridlocalization.validationstring;if(p.message!=undefined){l=p.message}var m=typeof p=="boolean"?p:p.result;if(!m){if(p.showmessage==undefined||p.showmessage==true){this._showvalidationpopup(h,n,l)}this.editcell.validated=false;return false}}catch(r){this._showvalidationpopup(h,n,this.gridlocalization.validationstring);this.editcell.validated=false;return false}}if(d.displayfield!=d.datafield){var k=this.getcellvalue(this.editcell.row,d.displayfield);var q=this.editcell.value;oldvalue={value:q,label:k}}else{oldvalue=this.editcell.value}var f=this.getrowdata(h);if(d.cellendedit){var s=d.cellendedit(h,n,d.columntype,this.editcell.value,i);if(s==false){this._raiseEvent(18,{rowindex:h,row:f,datafield:n,displayfield:d.displayfield,oldvalue:oldvalue,value:oldvalue,columntype:d.columntype});g(this);return false}}this._raiseEvent(18,{rowindex:h,row:f,datafield:n,displayfield:d.displayfield,oldvalue:oldvalue,value:i,columntype:d.columntype});this._hidecelleditor(false);if(this.editcell!=undefined){this.editcell.editor=null;this.editcell.editing=false}this.editcell=null;this.editchar=null;this.setcellvalue(h,n,i,e);if(!this.enablebrowserselection){this.host.addClass("jqx-disableselect");this.content.addClass("jqx-disableselect")}if(!a.jqx.browser.msie){t()}a.data(document.body,"jqxgrid.edit","");return true},beginrowedit:function(e){var d=this;var f=-1;d._oldselectedrow=e;this._cellscache=new Array();var c=false;if(this.editmode!="selectedrow"){c=true}if(c){var b=this.editmode;this.editmode="selectedrow"}a.each(this.columns.records,function(h,j){if(d.editable&&this.editable){var g=d.getcell(e,this.datafield);d.begincelledit(e,this.datafield,null,false,false);var i=d.getrowdata(e);d._raiseEvent(17,{rowindex:e,row:i,datafield:this.datafield,value:g.value,columntype:this.columntype})}});if(d.editcell){d.editcell.init=true}this._renderrows(this.virtualsizeinfo);if(c){this.editmode=b}},endrowedit:function(k,o){var D=this;if(!this.editcell){return false}if(this.editcell.editor==undefined){return false}var C=function(){if(focus!=false){if(D.isTouchDevice()){return}if(!D.isNestedGrid){var i=D.getScrollTop();var F=D.getScrollLeft();try{D.element.focus();D.content.focus();if(i!=D.getScrollTop()){window.scrollTo(F,i)}setTimeout(function(){D.element.focus();D.content.focus();if(i!=D.getScrollTop()){window.scrollTo(F,i)}},10)}catch(E){}}}};var p=false;if(this.editmode!="selectedrow"){p=true}if(p){var v=this.editmode;this.editmode="selectedrow"}var h=false;var d={};if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}for(var B=0;B<this.columns.records.length;B++){var e=this.columns.records[B];if(!e.editable){continue}if(e.hidden){continue}if(e.columntype=="checkbox"){continue}var l=this._geteditorvalue(e);var g=function(F){F._hidecelleditor();var E=F.getcellvalue(F.editcell.row,e.displayfield);if(e.cellendedit){e.cellendedit(k,u,e.columntype,E,l)}F.editchar=null;if(e.displayfield!=e.datafield){var i=F.getcellvalue(F.editcell.row,e.displayfield);var H=E;n={value:H,label:i}}else{n=E}var G=F.getrowdata(k);F._raiseEvent(18,{rowindex:k,row:G,datafield:u,displayfield:e.displayfield,oldvalue:E,value:E,columntype:e.columntype});F.editcell.editing=false};if(o){g(this);continue}if(e.cellvaluechanging){var n=this.getcellvalue(this.editcell.row,e.displayfield);var b=e.cellvaluechanging(k,u,e.columntype,n,l);if(b!=undefined){l=b}}var u=e.datafield;if(e.validation){var c=this.getcell(k,e.datafield);try{var w=e.validation(c,l);var r=this.gridlocalization.validationstring;if(w.message!=undefined){r=w.message}var t=typeof w=="boolean"?w:w.result;if(!t){if(w.showmessage==undefined||w.showmessage==true){this._showvalidationpopup(k,u,r)}h=true;this.editcell[e.datafield].validated=false;continue}}catch(z){this._showvalidationpopup(k,u,this.gridlocalization.validationstring);this.editcell[e.datafield].validated=false;h=true;continue}}if(e.displayfield!=e.datafield){var q=this.getcellvalue(this.editcell.row,e.displayfield);var x=this.editcell.value;n={value:x,label:q}}else{n=this.getcellvalue(this.editcell.row,e.displayfield)}d[e.datafield]={newvalue:l,oldvalue:n}}var y={};var s={};if(!h){this._hidecelleditor(false);for(var B=0;B<this.columns.records.length;B++){var e=this.columns.records[B];var u=e.datafield;if(e.hidden){continue}if(!e.editable){continue}var f=this.getrowdata(k);if(e.columntype=="checkbox"){var l=this.getcellvalue(k,e.displayfield);this._raiseEvent(18,{rowindex:k,row:f,datafield:e.datafield,displayfield:e.displayfield,oldvalue:l,value:l,columntype:e.columntype});continue}if(!d[e.datafield]){continue}var l=d[e.datafield].newvalue;var n=d[e.datafield].oldvalue;if(e.cellendedit){var A=e.cellendedit(k,u,e.columntype,n,l);if(A==false){this._raiseEvent(18,{rowindex:k,row:f,datafield:u,displayfield:e.displayfield,oldvalue:n,value:n,columntype:e.columntype});g(this);continue}}if(!this.source.updaterow){this._raiseEvent(18,{rowindex:k,row:f,datafield:e.datafield,displayfield:e.displayfield,oldvalue:n,value:l,columntype:e.columntype})}y[e.datafield]=l;s[e.datafield]=n}var j=this.getrowid(k);var f=this.getrowdata(k);a.each(y,function(i,F){if(F&&F.label!=undefined){var E=D.getcolumn(i);f[E.displayfield]=F.label;f[E.datafield]=F.value}else{f[i]=F}});if(!this.enablebrowserselection){this.host.addClass("jqx-disableselect");this.content.addClass("jqx-disableselect")}a.data(document.body,"jqxgrid.edit","");this.editcell=null;this.editchar=null;if(this.source.updaterow){var m=false;var D=this;var t=function(I){var G=D.source.updaterow;D.source.updaterow=null;if(false==I){a.each(s,function(i,K){if(K&&K.label!=undefined){var J=D.getcolumn(i);f[J.displayfield]=K.label;f[J.datafield]=K.value}else{f[i]=K}});D.updaterow(j,f)}else{D.updaterow(j,f)}for(var F=0;F<D.columns.records.length;F++){var H=D.columns.records[F];var E=H.datafield;D._raiseEvent(18,{rowindex:k,datafield:H.datafield,row:f,displayfield:H.displayfield,oldvalue:s[H.datafield],value:f[H.displayfield],columntype:H.columntype})}D.source.updaterow=G};try{m=this.source.updaterow(j,f,t);if(m==undefined){m=true}}catch(z){m=false;return}}else{this.updaterow(j,f);this._renderrows(this.virtualsizeinfo)}}if(p){this.editmode=v}return h},_selection:function(b){if("selectionStart" in b[0]){var g=b[0];var h=g.selectionEnd-g.selectionStart;return{start:g.selectionStart,end:g.selectionEnd,length:h,text:g.value}}else{var d=document.selection.createRange();if(d==null){return{start:0,end:g.value.length,length:0}}var c=b[0].createTextRange();var f=c.duplicate();c.moveToBookmark(d.getBookmark());f.setEndPoint("EndToStart",c);var h=d.text.length;return{start:f.text.length,end:f.text.length+d.text.length,length:h,text:d.text}}},_setSelection:function(e,b,d){if("selectionStart" in d[0]){d[0].focus();d[0].setSelectionRange(e,b)}else{var c=d[0].createTextRange();c.collapse(true);c.moveEnd("character",b);c.moveStart("character",e);c.select()}},findRecordIndex:function(g,c,b){var b=b;if(c){var e=b.length;for(var h=0;h<e;h++){var f=b[h];var d=f.label;if(g==d){return h}}}return -1},_destroyeditors:function(){var b=this;if(!this.columns.records){return}a.each(this.columns.records,function(f,j){var c=a.trim(this.datafield).split(" ").join("");switch(this.columntype){case"dropdownlist":var g=b.editors["dropdownlist_"+c];if(g){g.jqxDropDownList("destroy");b.editors["dropdownlist_"+c]=null}break;case"combobox":var k=b.editors["combobox_"+c];if(k){k.jqxComboBox("destroy");b.editors["combobox_"+c]=null}break;case"datetimeinput":var d=b.editors["datetimeinput_"+this.datafield];if(d){d.jqxDateTimeInput("destroy");b.editors["datetimeinput_"+c]=null}break;case"numberinput":var e=b.editors["numberinput_"+c];if(e){e.jqxNumberInput("destroy");b.editors["numberinput_"+c]=null}break;case"custom":case"template":if(b.destroyeditor){if(b.editors["templateeditor_"+c]){b.destroyeditor(b.editors["templateeditor_"+c]);b.editors["templateeditor_"+c]=null}}if(b.destroyeditor){var m=b.getrows.length();for(var l=0;l<m;l++){if(b.editors["customeditor_"+c+"_"+l]){b.destroyeditor(b.editors["customeditor_"+c+"_"+l],l);b.editors["customeditor_"+c+"_"+l]=null}}}break;case"textbox":default:var h=b.editors["textboxeditor_"+c];if(h){b.removeHandler(h,"keydown");b.editors["textbox_"+c]=null}break}});b.editors=new Array()},_showcelleditor:function(q,G,n,K,w){if(n==undefined){return}if(this.editcell==null){return}if(G.columntype=="checkbox"&&G.editable){return}if(w==undefined){w=true}if(this.editmode=="selectedrow"){this.editchar="";w=false}var E=G.datafield;var g=a(n);var s=this;var d=this.editcell.editor;var I=this.getcellvalue(q,E);var C=this.getcelltext(q,E);var j=this.hScrollInstance;var t=j.value;var i=parseInt(t);var J=this.columns.records.indexOf(G);this.editcell.element=n;if(this.editcell.validated==false){var H="";if(this.validationpopup){H=this.validationpopup.text()}this._showvalidationpopup(q,E,H)}var l=function(P){if(s.hScrollInstance.isScrolling()||s.vScrollInstance.isScrolling()){return}if(!w){return}if(s.isTouchDevice()){return}if(P){P.focus()}if(s.gridcontent[0].scrollTop!=0){s.scrolltop(Math.abs(s.gridcontent[0].scrollTop));s.gridcontent[0].scrollTop=0}if(s.gridcontent[0].scrollLeft!=0){s.gridcontent[0].scrollLeft=0}};switch(G.columntype){case"dropdownlist":if(this.host.jqxDropDownList){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");var A=a.trim(G.displayfield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}if(A.indexOf(".")!=-1){A=A.replace(".","")}var k=this.editors["dropdownlist_"+D];d=k==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='dropdownlisteditor'></div>"):k;d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(k==undefined){d.prependTo(this.table);d[0].id="dropdownlisteditor"+this.element.id+D;var f=this.source._source?true:false;var x=null;if(!f){x=new a.jqx.dataAdapter(this.source,{autoBind:false,uniqueDataFields:[A],async:false,autoSort:true,autoSortField:A})}else{var p={localdata:this.source.records,datatype:this.source.datatype,async:false};x=new a.jqx.dataAdapter(p,{autoBind:false,async:false,uniqueDataFields:[A],autoSort:true,autoSortField:A})}var u=!G.createeditor?true:false;d.jqxDropDownList({enableBrowserBoundsDetection:true,keyboardSelection:false,source:x,rtl:this.rtl,autoDropDownHeight:u,theme:this.theme,width:g.width()-2,height:g.height()-2,displayMember:A,valueMember:E});this.editors["dropdownlist_"+D]=d;if(G.createeditor){G.createeditor(q,I,d)}}if(G._requirewidthupdate){d.jqxDropDownList({width:g.width()-2})}var c=d.jqxDropDownList("listBox").visibleItems;if(!G.createeditor){if(c.length<8){d.jqxDropDownList("autoDropDownHeight",true)}else{d.jqxDropDownList("autoDropDownHeight",false)}}var I=this.getcellvalue(q,A);var z=this.findRecordIndex(I,A,c);if(K){if(I!=""){d.jqxDropDownList("selectIndex",z,true)}else{d.jqxDropDownList("selectIndex",-1)}}if(!this.editcell){return}if(this.editcell.defaultvalue!=undefined){d.jqxDropDownList("selectIndex",this.editcell.defaultvalue,true)}if(w){d.jqxDropDownList("focus")}}break;case"combobox":if(this.host.jqxComboBox){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");var A=a.trim(G.displayfield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}if(A.indexOf(".")!=-1){A=A.replace(".","")}var r=this.editors["combobox_"+D];d=r==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='comboboxeditor'></div>"):r;d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(r==undefined){d.prependTo(this.table);d[0].id="comboboxeditor"+this.element.id+D;var f=this.source._source?true:false;var x=null;if(!f){x=new a.jqx.dataAdapter(this.source,{autoBind:false,uniqueDataFields:[A],async:false,autoSort:true,autoSortField:A})}else{var p={localdata:this.source.records,datatype:this.source.datatype,async:false};x=new a.jqx.dataAdapter(p,{autoBind:false,async:false,uniqueDataFields:[A],autoSort:true,autoSortField:A})}var u=!G.createeditor?true:false;d.jqxComboBox({enableBrowserBoundsDetection:true,keyboardSelection:false,source:x,rtl:this.rtl,autoDropDownHeight:u,theme:this.theme,width:g.width()-2,height:g.height()-2,displayMember:A,valueMember:E});d.removeAttr("tabindex");d.find("div").removeAttr("tabindex");this.editors["combobox_"+D]=d;if(G.createeditor){G.createeditor(q,I,d)}}if(G._requirewidthupdate){d.jqxComboBox({width:g.width()-2})}var c=d.jqxComboBox("listBox").visibleItems;if(!G.createeditor){if(c.length<8){d.jqxComboBox("autoDropDownHeight",true)}else{d.jqxComboBox("autoDropDownHeight",false)}}var I=this.getcellvalue(q,A);var z=this.findRecordIndex(I,A,c);if(K){if(I!=""){d.jqxComboBox("selectIndex",z,true);d.jqxComboBox("val",I)}else{d.jqxComboBox("selectIndex",-1);d.jqxComboBox("val",I)}}if(!this.editcell){return}if(this.editcell.defaultvalue!=undefined){d.jqxComboBox("selectIndex",this.editcell.defaultvalue,true)}if(this.editchar&&this.editchar.length>0){d.jqxComboBox("input").val(this.editchar)}if(w){setTimeout(function(){l(d.jqxComboBox("input"));if(d){d.jqxComboBox("_setSelection",0,0);if(s.editchar){d.jqxComboBox("_setSelection",1,1);s.editchar=null}else{if(d.jqxComboBox("input")){var P=d.jqxComboBox("input").val();d.jqxComboBox("_setSelection",0,P.length)}}}},10)}}break;case"datetimeinput":if(this.host.jqxDateTimeInput){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var v=this.editors["datetimeinput_"+D];d=v==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='datetimeeditor'></div>"):v;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(v==undefined){d.prependTo(this.table);d[0].id="datetimeeditor"+this.element.id+D;var F={calendar:this.gridlocalization};d.jqxDateTimeInput({enableBrowserBoundsDetection:true,localization:F,_editor:true,theme:this.theme,rtl:this.rtl,width:g.width(),height:g.height(),formatString:G.cellsformat});this.editors["datetimeinput_"+D]=d;if(G.createeditor){G.createeditor(q,I,d)}}if(G._requirewidthupdate){d.jqxDateTimeInput({width:g.width()-2})}if(K){if(I!=""&&I!=null){var L=new Date(I);if(L=="Invalid Date"){if(this.source.getvaluebytype){L=this.source.getvaluebytype(I,{name:G.datafield,type:"date"})}}d.jqxDateTimeInput("setDate",L)}else{d.jqxDateTimeInput("setDate",null)}if(this.editcell.defaultvalue!=undefined){d.jqxDateTimeInput("setDate",this.editcell.defaultvalue)}}if(w){setTimeout(function(){l(d.jqxDateTimeInput("dateTimeInput"))},10)}}break;case"numberinput":if(this.host.jqxNumberInput){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var N=this.editors["numberinput_"+D];d=N==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='numbereditor'></div>"):N;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(N==undefined){d.prependTo(this.table);d[0].id="numbereditor"+this.element.id+D;var m="";var y="left";var M=2;if(G.cellsformat){if(G.cellsformat.indexOf("c")!=-1){m=this.gridlocalization.currencysymbol;y=this.gridlocalization.currencysymbolposition;if(y=="before"){y="left"}else{y="right"}if(G.cellsformat.length>1){M=parseInt(G.cellsformat.substring(1),10)}}else{if(G.cellsformat.indexOf("p")!=-1){m=this.gridlocalization.percentsymbol;y="right";if(G.cellsformat.length>1){M=parseInt(G.cellsformat.substring(1),10)}}}}else{M=0}d.jqxNumberInput({decimalSeparator:this.gridlocalization.decimalseparator,decimalDigits:M,inputMode:"simple",theme:this.theme,rtl:this.rtl,width:g.width()-1,height:g.height()-1,spinButtons:true,symbol:m,symbolPosition:y});this.editors["numberinput_"+D]=d;if(G.createeditor){G.createeditor(q,I,d)}}if(G._requirewidthupdate){d.jqxNumberInput({width:g.width()-2})}if(K){if(I!=""&&I!=null){var O=I;d.jqxNumberInput("setDecimal",O)}else{d.jqxNumberInput("setDecimal",0)}if(this.editcell.defaultvalue!=undefined){d.jqxNumberInput("setDecimal",this.editcell.defaultvalue)}if(this.editchar&&this.editchar.length>0){var o=parseInt(this.editchar);if(!isNaN(o)){d.jqxNumberInput("setDecimal",o)}}if(w){setTimeout(function(){l(d.jqxNumberInput("numberInput"));d.jqxNumberInput("_setSelectionStart",0);if(s.editchar){if(G.cellsformat.length>0){d.jqxNumberInput("_setSelectionStart",2)}else{d.jqxNumberInput("_setSelectionStart",1)}s.editchar=null}else{var P=d.jqxNumberInput("spinButtons");if(P){var Q=d.jqxNumberInput("numberInput").val();s._setSelection(d.jqxNumberInput("numberInput")[0],Q.length,Q.length)}else{var Q=d.jqxNumberInput("numberInput").val();s._setSelection(d.jqxNumberInput("numberInput")[0],0,Q.length)}}},10)}}}break;case"custom":n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var B=this.editors["customeditor_"+D+"_"+q];d=B==undefined?a("<div style='overflow: hidden; border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='customeditor'></div>"):B;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(B==undefined){d.prependTo(this.table);d[0].id="customeditor"+this.element.id+D+"_"+q;this.editors["customeditor_"+D+"_"+q]=d;var b=g.width()-1;var e=g.height()-1;d.width(b);d.height(e);if(G.createeditor){G.createeditor(q,I,d,C,b,e,this.editchar)}}if(G._requirewidthupdate){d.width(g.width()-2)}break;case"template":n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var h=this.editors["templateeditor_"+D];d=h==undefined?a("<div style='overflow: hidden; border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='templateeditor'></div>"):h;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(h==undefined){d.prependTo(this.table);d[0].id="templateeditor"+this.element.id+D;this.editors["templateeditor_"+D]=d;var b=g.width()-1;var e=g.height()-1;d.width(b);d.height(e);if(G.createeditor){G.createeditor(q,I,d,C,b,e,this.editchar)}}if(G._requirewidthupdate){d.width(g.width()-2)}break;case"textbox":default:n.innerHTML="";d=this.editors["textboxeditor_"+G.datafield]||a("<input autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' type='textbox' id='textboxeditor'/>");d[0].id="textboxeditor"+this.element.id+G.datafield;d.appendTo(g);if(this.rtl){d.css("direction","rtl")}if(K||d[0].className==""){d.addClass(this.toThemeProperty("jqx-input"));d.addClass(this.toThemeProperty("jqx-widget-content"));if(this.editchar&&this.editchar.length>0){d.val(this.editchar)}else{if(G.cellsformat!=""){I=this.getcelltext(q,E)}if(I==undefined){I=""}d.val(I)}if(this.editcell.defaultvalue!=undefined){d.val(this.editcell.defaultvalue)}d.width(g.width()+1);d.height(g.height()+1);if(G.createeditor){G.createeditor(q,I,d)}if(G.cellsformat!=""){if(G.cellsformat.indexOf("p")!=-1||G.cellsformat.indexOf("c")!=-1||G.cellsformat.indexOf("n")!=-1||G.cellsformat.indexOf("f")!=-1){if(!this.editors["textboxeditor_"+G.datafield]){d.keydown(function(Q){var W=Q.charCode?Q.charCode:Q.keyCode?Q.keyCode:0;var T=String.fromCharCode(W);var U=parseInt(T);if(isNaN(U)){return true}if(s._selection(d).length>0){return true}var S="";var R=d.val();if(G.cellsformat.length>1){var V=parseInt(G.cellsformat.substring(1));if(isNaN(V)){V=0}}else{var V=0}if(V>0){if(R.indexOf(s.gridlocalization.decimalseparator)!=-1){if(s._selection(d).start>R.indexOf(s.gridlocalization.decimalseparator)){return true}}}for(var X=0;X<R.length-V;X++){var P=R.substring(X,X+1);if(P.match(/^[0-9]+$/)!=null){S+=P}}if(S.length>=11){return false}})}}}}this.editors["textboxeditor_"+G.datafield]=d;if(K){if(w){setTimeout(function(){l(d);if(s.editchar){s._setSelection(d[0],1,1);s.editchar=null}else{s._setSelection(d[0],0,d.val().length)}},25)}}break}if(d){d[0].style.zIndex=1+n.style.zIndex;if(a.jqx.browser.msie&&a.jqx.browser.version<8){d[0].style.zIndex=1+this.columns.records.length+n.style.zIndex}d.css("display","block");this.editcell.editor=d;if(!this.editcell[E]){this.editcell[E]={};this.editcell[E].editor=d}else{this.editcell[E].editor=d}}if(K){if(G.initeditor){G.initeditor(q,I,d,C,this.editchar)}}if(s.isTouchDevice()){return}setTimeout(function(){if(s.content){s.content[0].scrollTop=0;s.content[0].scrollLeft=0}if(s.gridcontent){s.gridcontent[0].scrollLeft=0;s.gridcontent[0].scrollTop=0}},10)},_setSelection:function(d,g,b){try{if("selectionStart" in d){d.setSelectionRange(g,b)}else{var c=d.createTextRange();c.collapse(true);c.moveEnd("character",b);c.moveStart("character",g);c.select()}}catch(e){var f=e}},_hideeditors:function(){if(this.editcells!=null){var b=this;for(var c in this.editcells){b.editcell=b.editcells[c];b._hidecelleditor()}}},_hidecelleditor:function(b){if(!this.editcell){return}if(this.editmode==="selectedrow"){for(var c=0;c<this.columns.records.length;c++){var e=this.columns.records[c];if(this.editcell[e.datafield]&&this.editcell[e.datafield].editor){this.editcell[e.datafield].editor.hide();var d=this.editcell[e.datafield].editor;switch(e.columntype){case"dropdownlist":d.jqxDropDownList({closeDelay:0});d.jqxDropDownList("hideListBox");d.jqxDropDownList({closeDelay:300});break;case"combobox":d.jqxComboBox({closeDelay:0});d.jqxComboBox("hideListBox");d.jqxComboBox({closeDelay:300});break;case"datetimeinput":if(d.jqxDateTimeInput("isOpened")){d.jqxDateTimeInput({closeDelay:0});d.jqxDateTimeInput("hideCalendar");d.jqxDateTimeInput({closeDelay:300})}break}}}if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}return}if(this.editcell.columntype=="checkbox"){return}if(this.editcell.editor){this.editcell.editor.hide();switch(this.editcell.columntype){case"dropdownlist":this.editcell.editor.jqxDropDownList({closeDelay:0});this.editcell.editor.jqxDropDownList("hideListBox");this.editcell.editor.jqxDropDownList({closeDelay:300});break;case"combobox":this.editcell.editor.jqxComboBox({closeDelay:0});this.editcell.editor.jqxComboBox("hideListBox");this.editcell.editor.jqxComboBox({closeDelay:300});break;case"datetimeinput":var f=this.editcell.editor;if(f.jqxDateTimeInput("isOpened")){f.jqxDateTimeInput({closeDelay:0});f.jqxDateTimeInput("hideCalendar");f.jqxDateTimeInput({closeDelay:300})}break}}if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}if(!this.isNestedGrid){if(b!=false){this.element.focus()}}},_geteditorvalue:function(h){var o=new String();if(!this.editcell){return null}var l=this.editcell.editor;if(this.editmode=="selectedrow"){if(this.editcell[h.datafield]){var l=this.editcell[h.datafield].editor}}if(l){switch(h.columntype){case"textbox":default:o=l.val();if(h.cellsformat!=""){var n="string";var e=this.source.datafields||((this.source._source)?this.source._source.datafields:null);if(e){var p="";a.each(e,function(){if(this.name==h.displayfield){if(this.type){p=this.type}return false}});if(p){n=p}}var i=n==="number"||n==="float"||n==="int"||n==="integer";var f=n==="date"||n==="time";if(i||(n==="string"&&(h.cellsformat.indexOf("p")!=-1||h.cellsformat.indexOf("c")!=-1||h.cellsformat.indexOf("n")!=-1||h.cellsformat.indexOf("f")!=-1))){if(o===""&&h.nullable){return""}if(o.indexOf(this.gridlocalization.currencysymbol)>-1){o=o.replace(this.gridlocalization.currencysymbol,"")}var m=function(w,u,v){var s=w;if(u==v){return w}var t=s.indexOf(u);while(t!=-1){s=s.replace(u,v);t=s.indexOf(u)}return s};var k=o;k=new Number(k);if(!isNaN(k)){return k}o=m(o,this.gridlocalization.thousandsseparator,"");o=o.replace(this.gridlocalization.decimalseparator,".");if(o.indexOf(this.gridlocalization.percentsymbol)>-1){o=o.replace(this.gridlocalization.percentsymbol,"")}var d="";for(var r=0;r<o.length;r++){var b=o.substring(r,r+1);if(b==="-"){d+="-"}if(b==="."){d+="."}if(b.match(/^[0-9]+$/)!=null){d+=b}}o=d;o=o.replace(/ /g,"");o=new Number(o);if(isNaN(o)){o=""}}if(f||(n==="string"&&(h.cellsformat.indexOf("H")!=-1||h.cellsformat.indexOf("m")!=-1||h.cellsformat.indexOf("M")!=-1||h.cellsformat.indexOf("y")!=-1||h.cellsformat.indexOf("h")!=-1||h.cellsformat.indexOf("d")!=-1))){if(o===""&&h.nullable){return""}var c=o;o=new Date(o);if(o=="Invalid Date"||o==null){if(a.jqx.dataFormat){o=a.jqx.dataFormat.tryparsedate(c,this.gridlocalization)}if(o=="Invalid Date"||o==null){o=""}}}}if(h.displayfield!=h.datafield){o={label:o,value:o}}break;case"checkbox":if(l.jqxCheckBox){o=l.jqxCheckBox("checked")}break;case"datetimeinput":if(l.jqxDateTimeInput){l.jqxDateTimeInput({isEditing:false});l.jqxDateTimeInput("_validateValue");o=l.jqxDateTimeInput("getDate");if(o==null){return null}o=new Date(o.toString());if(h.displayfield!=h.datafield){o={label:o,value:o}}}break;case"dropdownlist":if(l.jqxDropDownList){var g=l.jqxDropDownList("selectedIndex");var q=l.jqxDropDownList("listBox").getVisibleItem(g);if(h.displayfield!=h.datafield){if(q){o={label:q.label,value:q.value}}else{o=""}}else{if(q){o=q.label}else{o=""}}if(o==null){o=""}}break;case"combobox":if(l.jqxComboBox){o=l.jqxComboBox("val");if(h.displayfield!=h.datafield){var q=l.jqxComboBox("getSelectedItem");if(q!=null){o={label:q.label,value:q.value}}}if(o==null){o=""}}break;case"numberinput":if(l.jqxNumberInput){if(this.touchdevice){l.jqxNumberInput("_doTouchHandling")}var j=l.jqxNumberInput("getDecimal");o=new Number(j);o=parseFloat(o);if(isNaN(o)){o=0}if(h.displayfield!=h.datafield){o={label:o,value:o}}}break}if(h.geteditorvalue){if(this.editmode=="selectedrow"){o=h.geteditorvalue(this.editcell.row,this.getcellvalue(this.editcell.row,h.datafield),l)}else{o=h.geteditorvalue(this.editcell.row,this.editcell.value,l)}}}return o},hidevalidationpopups:function(){if(this.popups){a.each(this.popups,function(){this.validation.remove();this.validationrow.remove()});this.popups=new Array()}if(this.validationpopup){this.validationpopuparrow.hide();this.validationpopup.hide()}},showvalidationpopup:function(f,j,h){if(h==undefined){var h=this.gridlocalization.validationstring}var g=a("<div style='z-index: 99999; top: 0px; left: 0px; position: absolute;'></div>");var r=a("<div style='width: 20px; height: 20px; z-index: 999999; top: 0px; left: 0px; position: absolute;'></div>");g.html(h);r.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));g.addClass(this.toThemeProperty("jqx-grid-validation"));g.addClass(this.toThemeProperty("jqx-rc-all"));g.prependTo(this.table);r.prependTo(this.table);var l=this.hScrollInstance;var n=l.value;var d=parseInt(n);var b=this.getcolumn(j).uielement;var p=null;for(var o=0;o<this.hittestinfo.length;o++){if(f===this.hittestinfo[o].row.visibleindex){p=this.hittestinfo[o]}}if(!p){this.ensurerowvisible(f);var s=this;g.remove();r.remove();setTimeout(function(){var v=null;for(var u=0;u<s.hittestinfo.length;u++){if(f===s.hittestinfo[u].row.visibleindex){v=s.hittestinfo[u]}}if(v){s.showvalidationpopup(f,j,h)}},25);return}var c=a(p.visualrow);g.css("top",parseInt(c.position().top)+30+"px");var k=parseInt(g.css("top"));r.css("top",k-12);r.removeClass();r.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));var q=false;if(k>=this._gettableheight()){r.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));r.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));k=parseInt(c.position().top)-this.rowsheight-5;if(k<0){k=0;this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));q=true}g.css("top",k+"px");r.css("top",k+g.outerHeight()-9)}var t=-d+parseInt(a(b).position().left);r.css("left",d+t+30);var m=g.width();if(m+t>this.host.width()-20){var e=m+t-this.host.width()+40;t-=e}if(!q){g.css("left",d+t)}else{g.css("left",d+parseInt(a(b).position().left)-g.outerWidth())}g.show();r.show();if(!this.popups){this.popups=new Array()}this.popups[this.popups.length]={validation:g,validationrow:r}},_showvalidationpopup:function(p,e,q){var c=this.editcell;var k=this.editcell.editor;if(this.editmode=="selectedrow"){var c=this.editcell[e];if(c&&c.editor){k=c.editor;c.element=k}}if(!k){return}if(this.validationpopup&&a.jqx.isHidden(this.validationpopup)){if(this.validationpopup.remove){this.validationpopup.remove();this.validationpopuparrow.remove()}this.validationpopup=null;this.validationpopuparrow=null;if(e===undefined&&q===undefined&&this.editors&&this.editors.length===0){return}}if(!this.validationpopup){var n=a("<div style='z-index: 99999; top: 0px; left: 0px; position: absolute;'></div>");var m=a("<div style='width: 20px; height: 20px; z-index: 999999; top: 0px; left: 0px; position: absolute;'></div>");n.html(q);m.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));n.addClass(this.toThemeProperty("jqx-grid-validation"));n.addClass(this.toThemeProperty("jqx-rc-all"));n.prependTo(this.table);m.prependTo(this.table);this.validationpopup=n;this.validationpopuparrow=m}else{this.validationpopup.html(q)}var h=this.hScrollInstance;var j=h.value;var g=parseInt(j);if(this.editmode=="selectedrow"){this.validationpopup.css("top",parseInt(a(c.editor).position().top)+(this.rowsheight+5)+"px")}else{this.validationpopup.css("top",parseInt(a(c.element).parent().position().top)+(this.rowsheight+5)+"px")}var b=parseInt(this.validationpopup.css("top"));this.validationpopuparrow.css("top",b-11);this.validationpopuparrow.removeClass();this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));var o=this._gettableheight();var f=false;if(b>=o){this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));b=parseInt(a(c.element).parent().position().top)-this.rowsheight-5;if(b<0){b=0;this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));f=true}this.validationpopup.css("top",b+"px");this.validationpopuparrow.css("top",b+this.validationpopup.outerHeight()-9)}var l=-g+parseInt(a(c.element).position().left);this.validationpopuparrow.css("left",g+l+30);var d=this.validationpopup.width();if(d+l>this.host.width()-20){var i=d+l-this.host.width()+40;l-=i}if(!f){this.validationpopup.css("left",g+l)}else{this.validationpopup.css("left",g+parseInt(a(c.element).position().left)-this.validationpopup.outerWidth())}if(this.editcell.editor.css("display")=="none"){this.validationpopup.hide();this.validationpopuparrow.hide()}else{this.validationpopup.show();this.validationpopuparrow.show()}}})})(jqxBaseFramework);

mercurial