Runner.buttonEvents["eliminar_log"] = function( pageObj, proxy, pageid ) {
	//register a new button
	pageObj.buttonNames[ pageObj.buttonNames.length ] = 'eliminar_log';
	
	if ( !pageObj.buttonEventBefore['eliminar_log'] ) {
		pageObj.buttonEventBefore['eliminar_log'] = function( params, ctrl, pageObj, proxy, pageid, rowData, row, submit ) {		
			var ajax = ctrl;


let timerInterval;
Swal.fire({
  title: "Eliminando Registros del Logs!",
 // html: "I will close in <b></b> milliseconds.",
  timer: 42000,
  timerProgressBar: true,
  didOpen: () => {
    Swal.showLoading();
    const timer = Swal.getPopup().querySelector("b");
    timerInterval = setInterval(() => {
      timer.textContent = `${Swal.getTimerLeft()}`;
    }, 100);
  },
  willClose: () => {
    clearInterval(timerInterval);
  }
}).then((result) => {
  /* Read more about handling dismissals below */
  if (result.dismiss === Swal.DismissReason.timer) {
    console.log("I was closed by the timer");
  }
});
		}
	}
	
	if ( !pageObj.buttonEventAfter['eliminar_log'] ) {
		pageObj.buttonEventAfter['eliminar_log'] = function( result, ctrl, pageObj, proxy, pageid, rowData, row, params ) {
			var ajax = ctrl;
Swal.fire ({
icon:'Realizado',
title:'Los registros fueron borrados' ,
text: 'de la tabla logs' })
.then ((result) => { location.reload();
});



		}
	}
	
	$('a[id="eliminar_log"]').each( function() {
		if ( $(this).closest('.gridRowAdd').length ) {
			return;
		}
		
		this.id = "eliminar_log" + "_" + Runner.genId();
		
		// create object
		var button_eliminar_log = new Runner.form.Button({
			id: this.id ,
			btnName: "eliminar_log"
		});
		
		// init
		button_eliminar_log.init( {args: [ pageObj, proxy, pageid ]} );
	});
};

