parent
25e4eacb1d
commit
90ae50b661
@ -1,7 +0,0 @@
|
|||||||
(function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(f){return d(f,window,document)}):"object"===typeof exports?module.exports=function(f,e){f||(f=window);if(!e||!e.fn.dataTable)e=require("datatables.net")(f,e).$;return d(e,f,f.document)}:d(jQuery,document)})(function(d,f){var e=function(a,c){var b=this;a.on("draw",function(){b._updateFadedRows()});var h=a.table(),g=f.createElement("div");g.className="slider";this.s=d.extend({},{dt:a,table:d(h.node()),slider:d(g)},
|
|
||||||
e.defaults,c);this._bind()};e.prototype={_bind:function(){var a=this,c=a.s;d(c.table,"> tbody").on("click",c.selector,function(){var b=d(this),b=b.is("tr")?b:b.closest("tr");b.is("tr")&&(b=c.dt.row(b),a._toggleChild(b))})},_toggleChild:function(a){var c=this.s;if(a.child.isShown())this._hideChild(a,function(){});else{var b=c.dt.row(".shown");b.length&&c.toggle?this._hideChild(b,this._showChildCallback(a)):this._showChild(a)}},_showChildCallback:function(a){return function(a){this._showChild(a)}.bind(this,
|
|
||||||
a)},_showChild:function(a){this.s.source(d(a.node()),this._response(a))},_response:function(a){return function(a,b){this.__showChild(a,b)}.bind(this,a)},__showChild:function(a,c){var b=this.s,e=b.slider;e.append(c);a.child(e,b.childClass).show();d(a.node()).toggleClass("shown");this._updateFadedRows();b.animateShow?this._showChildWithAnimation(a):this._showChildWithoutAnimation(a)},_showChildWithAnimation:function(a){var c=this.s;d(c.slider,a.child()).slideDown(c.animationSpeed,function(){c.onShown(a)})},
|
|
||||||
_showChildWithoutAnimation:function(a){var c=this.s;d(c.slider,a.child()).show();c.onShown(a)},_hideChild:function(a,c){var b=this.s;d(a.node()).toggleClass("shown");this._updateFadedRows();b.animateHide?this._hideChildWithAnimation(a,c):this._hideChildWithoutAnimation(a,c)},_hideChildWithAnimation:function(a,c){var b=this.s,e=b.slider;d(e,a.child()).slideUp(b.animationSpeed,function(){a.child.remove();e.empty();b.onHidden(a);c()})},_hideChildWithoutAnimation:function(a,c){var b=this.s,e=b.slider;
|
|
||||||
d(e,a.child()).hide();a.child.remove();e.empty();b.onHidden(a);c()},_updateFadedRows:function(){this.s.fadeNonShowingRows?(this._fadeNonShowingRows(),this._removeFadeFromShowingRows()):this._removeFadeFromRows()},_fadeNonShowingRows:function(){this.s.dt.rows(".shown:visible").count()?this.s.dt.rows(":visible:not(.shown):not(.faded)").nodes().to$().css("opacity",this.s.fadeOpacity).addClass("faded"):this._removeFadeFromRows()},_removeFadeFromShowingRows:function(){this.s.dt.rows(".shown.faded:visible").nodes().to$().css("opacity",
|
|
||||||
1).removeClass("faded")},_removeFadeFromRows:function(){this.s.dt.rows(".faded").nodes().to$().css("opacity",1).removeClass("faded")}};e.defaults={selector:"tr",childClass:"child",source:function(){},toggle:!0,animateShow:!0,animateHide:!0,fadeNonShowingRows:!1,fadeOpacity:0.4,animationSpeed:200,onShown:function(){},onHidden:function(){}};d.fn.dataTable.SlidingChild=e;d.fn.DataTable.SlidingChild=e;d(f).on("init.dt",function(a,c){if("dt"===a.namespace){var b=new d.fn.dataTable.Api(c);(d(b.table().node()).hasClass("slidingChild")||
|
|
||||||
c.oInit.slidingChild||d.fn.dataTable.defaults.slidingChild)&&new e(b,c.oInit.slidingChild)}})});
|
|
Loading…
Reference in new issue