!function(f){f.extend(f.jqx._jqxGrid.prototype,{getcolumnindex:function(e){var o=this.getcolumn(e);return this.columns.records.indexOf(o)},setcolumnindex:function(e,o,r){var t,s,l,i,d,c,u,n,a=this.getcolumn(e);a.pinned||a.hidden||a.checkboxcolumn||a.grouped||(t=this.columns.records.indexOf(a),this.columns.records.splice(t,1),this.columns.records.splice(o,0,a),s=0,l=this.headerZIndex,this.columnsrow.children().detach(),i=this.toThemeProperty("jqx-grid-cell"),i+=" "+this.toThemeProperty("jqx-grid-cell-pinned"),this.filterrow&&(f(this.filterrow.children()[0]).children().detach(),this.filterrow[0].cells=[]),(c=null)!=(d=this).filterrow&&(c=f(d.filterrow.children()[0])),u=!(this.columnsrow[0].cells=[]),f.each(this.columns.records,function(e,o){var r=this.uielement;d.columnsrow.append(r),d.rtl?r.css("z-index",l++):r.css("z-index",l--);var t,n=this.width;r.css("left",s),d.columnsrow[0].cells[d.columnsrow[0].cells.length]=r[0],d.filterrow&&(t=f('
'),c.append(t),t.css("left",s),t.css("z-index",l+1),t.width(this.width),t[0].left=s,t.append(this._filterwidget),d.filterrow[0].cells[d.filterrow[0].cells.length]=t[0]),this.hidden&&(u=!0),this.hidden&&this.hideable||(s+=n)}),!this.groupable||0<(n=this.groups.length)&&0<=t-n&&(t-=n,o-=n),this.rowdetails&&0<=t-1&&(t--,o--),"checkbox"==this.selectionmode&&0<=t-1&&(t--,o--),a=this._columns[t],this._columns.splice(t,1),this._columns.splice(o,0,a),this._raiseEvent(24,{columntext:a.text,datafield:a.datafield,oldindex:t,newindex:o}),0!=r&&(!u&&"checkbox"!=a.columntype||(this.prerenderrequired=!0,this.rendergridcontent(!0,!1)),this._updatecolumnwidths(),this._updatecellwidths(),this._updatefilterrowui&&this.filterable&&this.showfilterrow&&this._updatefilterrowui(),this.showeverpresentrow&&this._updateaddnewrowui(),this._rendercolumngroups(),this._renderrows(this.virtualsizeinfo)))},_pinnedColumnsLength:function(){var e=0;return f.each(this.columns.records,function(){this.pinned&&e++,this.grouped&&e++}),"checkbox"==this.selectionmode&&e++,e},_handlecolumnsreorder:function(){var e,o,r,a,h=this,m=-1,p=!1;h.columnsreorder&&(e="mousemove.reorder"+this.element.id,o="mousedown.reorder"+this.element.id,r="mouseup.reorder"+this.element.id,a=!1,this.isTouchDevice()&&!0!==this.touchmode&&(a=!0,e=f.jqx.mobile.getTouchEventName("touchmove")+".reorder"+this.element.id,o=f.jqx.mobile.getTouchEventName("touchstart")+".reorder"+this.element.id,r=f.jqx.mobile.getTouchEventName("touchend")+".reorder"+this.element.id),this.removeHandler(f(document),e),this.addHandler(f(document),e,function(e){if(h.resizing)return!0;if(null!=h.reordercolumn){var o,r=parseInt(e.pageX),t=parseInt(e.pageY);!a||null!=(o=h.getTouches(e)[0])&&(r=parseInt(o.pageX),t=parseInt(o.pageY));var n=h.host.coord(),s=parseInt(n.left),l=parseInt(n.top);null!=h.dragmousedownoffset&&null!=h.dragmousedownoffset||(h.dragmousedownoffset={left:0,top:0});var i,d,c=parseInt(r)-parseInt(h.dragmousedownoffset.left),u=parseInt(t)-parseInt(h.dragmousedownoffset.top);if(h.reordercolumn.css({left:c+"px",top:u+"px"}),p=!1,s<=r&&r<=s+h.host.width()&&l<=t&&t<=l+h.host.height()&&(p=!0),m=-1,p?(h.reordercolumnicon.removeClass(h.toThemeProperty("jqx-grid-dragcancel-icon")),h.reordercolumnicon.addClass(h.toThemeProperty("jqx-grid-drag-icon")),d=(i=h.columnsheader.coord()).top+h.columnsheader.height(),null!=h.columnsdropline&&(t>=i.top&&t<=d?m=h._handlereordercolumnsdroplines(r):h.columnsdropline.fadeOut("slow"))):(null!=h.columnsdropline&&h.columnsdropline.fadeOut("slow"),h.reordercolumnicon.removeClass(h.toThemeProperty("jqx-grid-drag-icon")),h.reordercolumnicon.addClass(h.toThemeProperty("jqx-grid-dragcancel-icon"))),a)return e.preventDefault(),e.stopPropagation(),!1}}),this.columnsbounds=new Array,this.removeHandler(f(document),o),this.addHandler(f(document),o,function(e){if(h.resizing)return!0;h.columnsbounds=new Array;var t=h.host.coord().left,n=h.host.coord().top;h.showtoolbar&&(n+=h.toolbarheight),h.groupable&&h.showgroupsheader&&(n+=h.groupsheaderheight);var s=0;f.each(h.columns.records,function(e){var o=this;if(o.hidden)return h.columnsbounds[h.columnsbounds.length]={top:n,column:o,left:t,width:0,height:2+h.rowsheight},!0;0==s&&(t=h.rtl?"hidden"!=h.hScrollBar.css("visibility")?parseInt(h.host.coord().left)-h.hScrollInstance.max+h.hScrollInstance.value:"hidden"==h.vScrollBar.css("visibility")?f(o.element).coord().left:f(o.element).coord().left-h.vScrollBar.width()-h.host.offset().left:parseInt(h.host.coord().left)-h.hScrollInstance.value),s++;var r=2+h.columnsheight;h.columnshierarchy&&(n=f(o.uielement).coord().top,r=f(o.uielement).height()),h.columnsbounds[h.columnsbounds.length]={top:n,column:o,left:t,width:o.width,height:r},t+=o.width})}),this.removeHandler(f(document),r),this.addHandler(f(document),r,function(e){if(h.resizing)return!0;h.__drag=!1,f(document.body).removeClass("jqx-disableselect");var o;parseInt(e.pageX),parseInt(e.pageY);a&&(o=h.getTouches(e)[0],parseInt(o.pageX),parseInt(o.pageY));var r=h.host.coord();parseInt(r.left),parseInt(r.top),h.groupsheader.height();if(h.showtoolbar&&h.toolbarheight,h.columndragstarted=!1,(h.dragmousedown=null)!=h.reordercolumn){var t=f.data(h.reordercolumn[0],"reorderrecord"),n=h.columns.records.indexOf(h.getcolumn(t));h.reordercolumn.remove(),h.reordercolumn=null;var s=0;if(s+=h._pinnedColumnsLength(),null!=t){if(p&&-1!=m){var l=m.index;if(s<=l){var i=h.columns.records[l];if(null!=i){var d=h.columns.records.indexOf(h.getcolumn(i.datafield));if(null==i.datafield&&(d=h.columns.records.indexOf(h.getcolumnbytext(i.text))),h.columngroups){var c=i;if(n