Adjust DataTable pagination of Non-MainWP changes and Monitors

I like my widgets organized and small/neat without scrollbars. So, I had to add an pagination of [1] to both Non-MainWP changes and Monitor datatable.

Below the JS code for MainWP Custom Dashboard extension.

var waitForEl = function(selector, callback) {
	if (jQuery(selector).length) {
	    callback();
	} else {
	    setTimeout(function() {
   			waitForEl(selector, callback);
	    }, 100);
	}
};

jQuery( document ).ready( function () {

	// adjust non-mainwp action table page length
	// hooking into wrapper
	
	var selector = '#mainwp-non-mainwp-changes-table_wrapper';
	
	waitForEl(selector, function() {
		table = jQuery( '#mainwp-non-mainwp-changes-table' ).DataTable( {
			"destroy":true,
			"pageLength": 1,
			"lengthMenu": [ [1, 5, 10, 25, 50, 100, -1], [1, 5, 10, 25, 50, 100, "All"] ]
		} );
	});

	var selector = '#mainwp-aum-monitors-widget-table_wrapper';
	
	waitForEl(selector, function() {
		table = jQuery( '#mainwp-aum-monitors-widget-table' ).DataTable( {
			"destroy":true,
			"pageLength": 1,
			"lengthMenu": [ [1, 5, 10, 25, 50, 100, -1], [1, 5, 10, 25, 50, 100, "All"] ]
		} );
	});
});

Maybe somebody is as autistic as me and finds this usefull :P.

Hi @opicron1

Thanks very much for sharing this with the community.

I’ll pass it along to the development team in case they might find it helpful or interesting.