1 line
2.1 KiB
JavaScript
1 line
2.1 KiB
JavaScript
(function(a){var b=a.telerik;b.resizing={};b.resizing.initialize=function(p){var c,o=a('<div class="t-grid-resize-indicator" />'),j,d,i,m=3;function n(q,r){a("th, th .t-grid-filter, th .t-link",q).add(document.body).css("cursor",r)}function l(q){var r=0;a(".t-grouping-header, .t-grid-toolbar, > .t-pager-wrapper",q).each(function(){r+=this.offsetHeight});return r}function e(t){var r=0;a(".t-resize-handle",p.element).each(function(){r+=a(this).data("th").outerWidth();a(this).css("left",r-m)});r=-p.$tbody.closest(".t-grid-content").scrollLeft();t.prevAll("th").add(t).each(function(){r+=this.offsetWidth});var q=p.scrollable?a(".t-grid-content",p.element):a("tbody",p.element);var s=q.attr(p.scrollable?"clientWidth":"offsetWidth");if(r>=s){o.remove()}else{o.css({left:r,top:l(p.element),height:t.outerHeight()+q.attr(p.scrollable?"clientHeight":"offsetHeight")});if(!o.parent().length){o.appendTo(p.element)}}}function k(r){var q=r.$draggable.data("th");c=a("colgroup",p.element).find("col:eq("+q.index()+")");i=r.pageX;d=q.outerWidth();j=p.$tbody.outerWidth()}function h(q){var r=d+q.pageX-i;if(r>10){c.css("width",r);if(p.scrollable){p.$tbody.parent().add(p.$headerWrap.find("table")).add(p.$footerWrap.find("table")).css("width",j+q.pageX-i)}e(q.$draggable.data("th"))}}function g(s){o.remove();n(p.element,"");var r=s.$draggable.data("th");var q=r.outerWidth();if(p.onColumnResize&&q!=d){b.trigger(p.element,"columnResize",{column:p.columns[p.$columns().index(r)],oldWidth:d,newWidth:q})}return false}var f=0;a(p.element).bind("mouseenter",function(){a(this).unbind("mouseenter",arguments.callee).find(".t-header").each(function(){f+=this.offsetWidth;var q=a(this);if(!q.hasClass("t-group-cell")){a('<div class="t-resize-handle" />').css({left:f-m,top:p.scrollable?0:l(p.element),width:m*2}).appendTo(p.scrollable?p.$headerWrap:p.element).data("th",q).mousedown(function(){e(q);n(p.element,a(this).css("cursor"))}).mouseup(function(){n(p.element,"")})}});new b.draggable({owner:p.element,selector:".t-resize-handle",scope:p.element.id+"-column-resizing",distance:0,start:k,drag:h,stop:g})})}})(jQuery); |