mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Fix: jQuery 3.2 deprecates direct calling of event triggers (e.g. $().scroll()
in this case)
- DD-610
This commit is contained in:
parent
5e6ca62d1d
commit
9f591da9e2
@ -1 +1 @@
|
||||
c1ed5705a6edb0ade89ec7273b43be51768e9fa2
|
||||
a9adc6dc579bf073269aac754c9727cef1dc45bb
|
||||
|
2
media/js/jquery.dataTables.js
vendored
2
media/js/jquery.dataTables.js
vendored
@ -5457,7 +5457,7 @@
|
||||
table.children('colgroup').insertBefore( table.children('thead') );
|
||||
|
||||
/* Adjust the position of the header in case we loose the y-scrollbar */
|
||||
divBody.scroll();
|
||||
divBody.trigger('scroll');
|
||||
|
||||
// If sorting or filtering has occurred, jump the scrolling back to the top
|
||||
// only if we aren't holding the position
|
||||
|
4
media/js/jquery.dataTables.min.js
vendored
4
media/js/jquery.dataTables.min.js
vendored
@ -71,8 +71,8 @@ x=A.bScrollOversize,ac=J(a.aoColumns,"nTh"),Ya=[],y=[],z=[],C=[],G,H=function(a)
|
||||
c||(u.width="100%",h[0].style.width="100%");f.each(ua(a,I),function(b,c){G=ba(a,b);c.style.width=a.aoColumns[G].sWidth});T&&N(function(a){a.style.width=""},E);h=r.outerWidth();""===c?(za.width="100%",x&&(r.find("tbody").height()>k.offsetHeight||"scroll"==n.css("overflow-y"))&&(za.width=B(r.outerWidth()-b)),h=r.outerWidth()):""!==d&&(za.width=B(d),h=r.outerWidth());N(H,D);N(function(a){z.push(a.innerHTML);Ya.push(B(f(a).css("width")))},D);N(function(a,b){-1!==f.inArray(a,ac)&&(a.style.width=Ya[b])},
|
||||
t);f(D).height(0);T&&(N(H,E),N(function(a){C.push(a.innerHTML);y.push(B(f(a).css("width")))},E),N(function(a,b){a.style.width=y[b]},F),f(E).height(0));N(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+z[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=Ya[b]},D);T&&N(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+C[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=y[b]},E);r.outerWidth()<
|
||||
h?(F=k.scrollHeight>k.offsetHeight||"scroll"==n.css("overflow-y")?h+b:h,x&&(k.scrollHeight>k.offsetHeight||"scroll"==n.css("overflow-y"))&&(za.width=B(F-b)),""!==c&&""===d||O(a,1,"Possible column misalignment",6)):F="100%";u.width=B(F);g.width=B(F);T&&(a.nScrollFoot.style.width=B(F));!e&&x&&(u.height=B(w.offsetHeight+b));c=r.outerWidth();m[0].style.width=B(c);l.width=B(c);d=r.height()>k.clientHeight||"scroll"==n.css("overflow-y");e="padding"+(A.bScrollbarLeft?"Left":"Right");l[e]=d?b+"px":"0px";T&&
|
||||
(q[0].style.width=B(c),v[0].style.width=B(c),v[0].style[e]=d?b+"px":"0px");r.children("colgroup").insertBefore(r.children("thead"));n.scroll();!a.bSorted&&!a.bFiltered||a._drawHold||(k.scrollTop=0)}}function N(a,b,c){for(var d=0,e=0,h=b.length,g,k;e<h;){g=b[e].firstChild;for(k=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,k,d):a(g,d),d++),g=g.nextSibling,k=c?k.nextSibling:null;e++}}function Ja(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,h=d.sX,g=d.sXInner,k=c.length,l=oa(a,"bVisible"),m=
|
||||
f("th",a.nTHead),n=b.getAttribute("width"),p=b.parentNode,v=!1,q,t=a.oBrowser;d=t.bScrollOversize;(q=b.style.width)&&-1!==q.indexOf("%")&&(n=q);for(q=0;q<l.length;q++){var r=c[l[q]];null!==r.sWidth&&(r.sWidth=Jb(r.sWidthOrig,p),v=!0)}if(d||!v&&!h&&!e&&k==W(a)&&k==m.length)for(q=0;q<k;q++)l=ba(a,q),null!==l&&(c[l].sWidth=B(m.eq(q).width()));else{k=f(b).clone().css("visibility","hidden").removeAttr("id");k.find("tbody tr").remove();var w=f("<tr/>").appendTo(k.find("tbody"));k.find("thead, tfoot").remove();
|
||||
(q[0].style.width=B(c),v[0].style.width=B(c),v[0].style[e]=d?b+"px":"0px");r.children("colgroup").insertBefore(r.children("thead"));n.trigger("scroll");!a.bSorted&&!a.bFiltered||a._drawHold||(k.scrollTop=0)}}function N(a,b,c){for(var d=0,e=0,h=b.length,g,k;e<h;){g=b[e].firstChild;for(k=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,k,d):a(g,d),d++),g=g.nextSibling,k=c?k.nextSibling:null;e++}}function Ja(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,h=d.sX,g=d.sXInner,k=c.length,l=oa(a,"bVisible"),
|
||||
m=f("th",a.nTHead),n=b.getAttribute("width"),p=b.parentNode,v=!1,q,t=a.oBrowser;d=t.bScrollOversize;(q=b.style.width)&&-1!==q.indexOf("%")&&(n=q);for(q=0;q<l.length;q++){var r=c[l[q]];null!==r.sWidth&&(r.sWidth=Jb(r.sWidthOrig,p),v=!0)}if(d||!v&&!h&&!e&&k==W(a)&&k==m.length)for(q=0;q<k;q++)l=ba(a,q),null!==l&&(c[l].sWidth=B(m.eq(q).width()));else{k=f(b).clone().css("visibility","hidden").removeAttr("id");k.find("tbody tr").remove();var w=f("<tr/>").appendTo(k.find("tbody"));k.find("thead, tfoot").remove();
|
||||
k.append(f(a.nTHead).clone()).append(f(a.nTFoot).clone());k.find("tfoot th, tfoot td").css("width","");m=ua(a,k.find("thead")[0]);for(q=0;q<l.length;q++)r=c[l[q]],m[q].style.width=null!==r.sWidthOrig&&""!==r.sWidthOrig?B(r.sWidthOrig):"",r.sWidthOrig&&h&&f(m[q]).append(f("<div/>").css({width:r.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(q=0;q<l.length;q++)v=l[q],r=c[v],f(Kb(a,v)).clone(!1).append(r.sContentPadding).appendTo(w);f("[name]",k).removeAttr("name");r=f("<div/>").css(h||
|
||||
e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(k).appendTo(p);h&&g?k.width(g):h?(k.css("width","auto"),k.removeAttr("width"),k.width()<p.clientWidth&&n&&k.width(p.clientWidth)):e?k.width(p.clientWidth):n&&k.width(n);for(q=e=0;q<l.length;q++)p=f(m[q]),g=p.outerWidth()-p.width(),p=t.bBounding?Math.ceil(m[q].getBoundingClientRect().width):p.outerWidth(),e+=p,c[l[q]].sWidth=B(p-g);b.style.width=B(e);r.remove()}n&&(b.style.width=B(n));!n&&!h||a._reszEvt||(b=function(){f(z).on("resize.DT-"+
|
||||
a.sInstance,Sa(function(){aa(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0)}function Jb(a,b){if(!a)return 0;a=f("<div/>").css("width",B(a)).appendTo(b||y.body);b=a[0].offsetWidth;a.remove();return b}function Kb(a,b){var c=Lb(a,b);if(0>c)return null;var d=a.aoData[c];return d.nTr?d.anCells[b]:f("<td/>").html(I(a,c,b,"display"))[0]}function Lb(a,b){for(var c,d=-1,e=-1,h=0,g=a.aoData.length;h<g;h++)c=I(a,h,b,"display")+"",c=c.replace(bc,""),c=c.replace(/ /g," "),c.length>d&&(d=c.length,e=h);return e}
|
||||
|
Loading…
x
Reference in New Issue
Block a user