mhamano/Qlik-Sense-Reload-Button

Doesn't work in QlikSense desktop 3.2 SR3

Closed this issue · 5 comments

It's doesn't work in QS 3.2 SR3

Well, I've seen it's work but show Fail message equaly

Same issue. Using the reload extension, but since update to last version, fails to work.
Last Qlik Sense Desktop version seems to have broken quite a few extensions.

hi @timpoismans , meanwhile the author give us a solution I solved it in my way, must change the ReloadButton.js:

`define(["jquery", "qlik", "text!./lib/css/reload_btn.css"], function($, qlik, cssContent) {

$("<style>").html(cssContent).appendTo("head");

return {		
	paint: function ($element, layout) {
	                                           
        var app = qlik.currApp(this);  	
	  
	    //Check if Qlik Sense Desktop or Server
	  	var isPersonalMode = true;
	  
		var global = qlik.getGlobal();
		global.isPersonalMode( function ( reply ) {
			isPersonalMode = reply.qReturn;
								
		});
		
	    // Display Extension Visualization
		var html = html = '<a href="#" id="modal-open" class="btn btn-primary">Recargar</a>'; 
        $element.html( html );
	
		// Open modal 
		$("#modal-open").click(
			function(event){
				event.preventDefault(); 
				
				$(this).blur() ;	
				
				// Check if modal is displayed 
				if($("#modal-overlay")[0]) return false ;
				
				// Add modal overlay
				$(".qv-panel-sheet").append('<div id="modal-overlay"></div>');
				$("#modal-overlay").fadeIn("slow");

				// Add modal panel
				$(".qv-panel-sheet").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>¿Estás seguro de recargar?</h2></div><div id="modal-checkbox"><input type="checkbox" id="partial" name="partial" value=""><label for="partial">Recarga parcial</label></div><div id="modal-botton"><a href="#" id="execute-reload" class="btn btn-primary"> OK </a><a href="#" id="modal-close" class="btn btn-danger">Cancelar</a></div></div>');					
				$("#modal-content").fadeIn("slow");
				
				// Close modal 
				$("#modal-overlay, #modal-close").unbind().click(
					function(event){
						event.preventDefault(); 
				
						$("#modal-content,#modal-overlay").fadeOut("slow",function(){
							$("#modal-content").remove();
							$("#modal-overlay").remove();
						});
					}
				);

				// Execute reload								
				$("#execute-reload").click(	
					function(event){
						event.preventDefault();
						
						// Check if reload is partial
						var isPartial = false;
						if($("#partial").prop('checked')) {
							isPartial = true;
						}
												
						// Remove modal
						$("#modal-content").remove();
						
						// Open loader circle
						$("#modal-overlay").append('<div id="loader" class="loader">Cargando...</div>');
						
						//console.log("isPersonalMode: " + isPersonalMode);
						//console.log("isPartial: " + isPartial);
						
						//Execute reload
						if ( isPersonalMode ) {
							app.doReload( 0, isPartial, false ).then( function (e) {
								$("#loader").remove();
								//console.log(e.qReturn);
								//console.log(e);
								//if (e.qReturn) {
								if (e.qReturn === undefined) {
									console.log("Posterior 3.2");
									
									if (e) {
										app.doSave();
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga ejecutada!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-success">Cerrar</a></div></div>');
									} else {
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga fallida!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-danger">Cerrar</a></div></div>');										
									}
									
								} else {
									console.log("Anterior 3.2");
									
									if (e.qReturn) {
										app.doSave();
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga ejecutada!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-success">Cerrar</a></div></div>');
									} else {
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga fallida!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-danger">Cerrar</a></div></div>');										
									}
									
								}
								$("#modal-content").fadeIn("slow");
							} );
						} else {
							// qlik.callRepository( '/qrs/app/' + appid + '/reload', 'POST' ).success( function ( reply ) {
							//	$("#modal-overlay").remove()
							// } );
							app.doReload( 0, isPartial, false ).then( function (e) {
								$("#loader").remove();
								if (e.qReturn === undefined) {
									console.log("Posterior 3.2");
									
									if (e) {
										app.doSave();
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga ejecutada!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-success">Cerrar</a></div></div>');
									} else {
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga fallida!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-danger">Cerrar</a></div></div>');										
									}
									
								} else {
									console.log("Anterior 3.2");
									
									if (e.qReturn) {
										app.doSave();
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga ejecutada!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-success">Cerrar</a></div></div>');
									} else {
										$("#modal-overlay").append('<div id="modal-content" style="display:none"><div id="modal-message"><h2>Recarga fallida!</h2></div><br><div id="modal-checkbox"><a href="#" id="modal-close" class="btn btn-danger">Cerrar</a></div></div>');										
									}
									
								}
								$("#modal-content").fadeIn("slow");
							} );
						}
					}										
				);					
			}
		);
	}
};

} );

`

And reinstall

I'll try this out during the next few days and I'll let you know how it's going.
Thanks in advance!

Hi all. I have committed the fixed codes to make this extension work on QS3.2SR3. Thank you for your cooperation!