Fix - features: Features which listen for the `init.dt` event need to check that the `dt` event namespace has been given.

See https://github.com/DataTables/Responsive/issues/30 for details
pull/183/head
Allan Jardine 10 years ago
parent dc0e9c7658
commit be28df9f75

@ -28,6 +28,10 @@
(function(window, document, $) {
$(document).on('init.dt', function(e, dtSettings) {
if ( e.namespace !== 'dt' ) {
return;
}
var options = dtSettings.oInit.conditionalPaging;
if ($.isPlainObject(options) || options === true) {

@ -58,7 +58,8 @@ var PageResize = function ( dt )
this._attach();
this._size();
}
};
PageResize.prototype = {
_size: function ()
@ -127,6 +128,10 @@ $.fn.DataTable.PageResize = PageResize;
// Automatic initialisation listener
$(document).on( 'init.dt', function ( e, settings ) {
if ( e.namespace !== 'dt' ) {
return;
}
var api = new $.fn.dataTable.Api( settings );
if ( $( api.table().node() ).hasClass( 'pageResize' ) ||

@ -4,4 +4,4 @@
*/
(function(c){var e=function(a){var b=a.table();this.s={dt:a,host:c(b.container()).parent(),header:c(b.header()),footer:c(b.footer()),body:c(b.body()),container:c(b.container()),table:c(b.node())};a=this.s.host;"static"===a.css("position")&&a.css("position","relative");this._attach();this._size()};e.prototype={_size:function(){var a=this.s,b=a.dt;b.table();var f=c(a.table).offset().top,e=c("tr",a.body).eq(0).height(),d=a.host.height(),d=d-a.header.height(),d=d-a.footer.height(),d=d-f-(a.container.height()-
(f+a.table.height())),a=Math.floor(d/e);a!==b.page.len()&&b.page.len(a).draw()},_attach:function(){var a=this,b=c("<object/>").css({position:"absolute",top:0,left:0,height:"100%",width:"100%",zIndex:-1}).attr("type","text/html").attr("data","about:blank");b[0].onload=function(){var b=this.contentDocument.body,c=b.offsetHeight;this.contentDocument.defaultView.onresize=function(){var d=b.offsetHeight;d!==c&&(c=d,a._size())}};b.appendTo(this.s.host)}};c.fn.dataTable.PageResize=e;c.fn.DataTable.PageResize=
e;c(document).on("init.dt",function(a,b){var f=new c.fn.dataTable.Api(b);(c(f.table().node()).hasClass("pageResize")||b.oInit.pageResize||c.fn.dataTable.defaults.pageResize)&&new e(f)})})(jQuery);
e;c(document).on("init.dt",function(a,b){if("dt"===a.namespace){var f=new c.fn.dataTable.Api(b);(c(f.table().node()).hasClass("pageResize")||b.oInit.pageResize||c.fn.dataTable.defaults.pageResize)&&new e(f)}})})(jQuery);

@ -49,6 +49,10 @@ function highlight( body, table )
// Listen for DataTables initialisations
$(document).on( 'init.dt.dth', function (e, settings, json) {
if ( e.namespace !== 'dt' ) {
return;
}
var table = new $.fn.dataTable.Api( settings );
var body = $( table.table().body() );

@ -2,5 +2,5 @@
SearchHighlight for DataTables v1.0.1
2014 SpryMedia Ltd - datatables.net/license
*/
(function(h,g,b){function e(d,c){d.unhighlight();c.rows({filter:"applied"}).data().length&&d.highlight(b.trim(c.search()).split(/\s+/))}b(g).on("init.dt.dth",function(d,c){var a=new b.fn.dataTable.Api(c),f=b(a.table().body());if(b(a.table().node()).hasClass("searchHighlight")||c.oInit.searchHighlight||b.fn.dataTable.defaults.searchHighlight)a.on("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",function(){e(f,a)}).on("destroy",function(){a.off("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth")}),
a.search()&&e(f,a)})})(window,document,jQuery);
(function(h,g,b){function e(d,c){d.unhighlight();c.rows({filter:"applied"}).data().length&&d.highlight(b.trim(c.search()).split(/\s+/))}b(g).on("init.dt.dth",function(d,c){if("dt"===d.namespace){var a=new b.fn.dataTable.Api(c),f=b(a.table().body());if(b(a.table().node()).hasClass("searchHighlight")||c.oInit.searchHighlight||b.fn.dataTable.defaults.searchHighlight)a.on("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",function(){e(f,a)}).on("destroy",function(){a.off("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth")}),
a.search()&&e(f,a)}})})(window,document,jQuery);

Loading…
Cancel
Save