1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-25 17:17:02 +00:00
Lidarr/packages/TelerikMvcExtensions.2011.3.1115/content/Scripts/2011.3.1115/telerik.grid.reordering.min.js
2011-11-22 17:51:44 -08:00

1 line
No EOL
2.3 KiB
JavaScript

(function(a){var b=a.telerik;b.scripts.push("telerik.grid.reordering.js");b.reordering={};b.reordering.initialize=function(c){c.$reorderDropCue=a('<div class="t-reorder-cue"><div class="t-icon t-arrow-down"></div><div class="t-icon t-arrow-up"></div></div>');var d=c.$header.children("th").length-1;var f=function(h,g){var j=a.inArray(g,c.columns);c.columns.splice(j,1);c.columns.splice(h,0,g);e(c.$columns(),j,h);e(c.$tbody.parent().find("> colgroup > col:not(.t-group-col,.t-hierarchy-col)"),j,h);e(c.$headerWrap.find("table").find("> colgroup > col:not(.t-group-col,.t-hierarchy-col)"),j,h);var i=c.$footer.find("table");e(i.find("> colgroup > col:not(.t-group-col,.t-hierarchy-col)"),j,h);e(i.find("> tbody > tr.t-footer-template > td:not(.t-group-cell,.t-hierarchy-cell)").add(c.$footer.find("tr.t-footer-template > td:not(.t-group-cell,.t-hierarchy-cell)")),j,h);a.each(c.$tbody.children(),function(){e(a(this).find(" > td:not(.t-group-cell, .t-hierarchy-cell, .t-detail-cell)"),j,h)})};c.reorderColumn=f;function e(j,k,i){var h=j.eq(k);var g=j.eq(i);h[k>i?"insertBefore":"insertAfter"](g)}new b.draggable({owner:c.$header[0],selector:".t-header:not(.t-group-cell,.t-hierarchy-cell)",scope:c.element.id+"-reodering",cue:function(g){return b.dragCue(g.$draggable.text())},destroy:function(g){g.$cue.remove()}});new b.droppable({owner:c.$header[0],scope:c.element.id+"-reodering",selector:".t-header:not(.t-group-cell,.t-hierarchy-cell)",over:function(g){var h=a.trim(g.$draggable.text())==a.trim(g.$droppable.text());b.dragCueStatus(g.$cue,h?"t-denied":"t-add");var i=0;a("> .t-grid-top, > .t-grouping-header",c.element).each(function(){i+=a(this).outerHeight()});if(!h){c.$reorderDropCue.css({height:g.$droppable.outerHeight(),top:i,left:function(){return g.$droppable.position().left+((g.$droppable.index()>g.$draggable.index())?g.$droppable.outerWidth():0)}}).appendTo(c.element)}},out:function(g){c.$reorderDropCue.remove();b.dragCueStatus(g.$cue,"t-denied")},drop:function(h){c.$reorderDropCue.remove();if(h.$cue.find(".t-drag-status").is(".t-add")){var g=c.columnFromTitle(a.trim(h.$draggable.text()));var i=c.$columns().index(h.$droppable.closest(".t-header"));b.trigger(c.element,"columnReorder",{column:g,oldIndex:a.inArray(g,c.columns),newIndex:i});f(i,g);b.trigger(c.element,"repaint")}}})}})(jQuery);