Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a custom webpage on an IIS server with some mashup content plugged in. It is working fine. I need to add a button to allow the user to clear selections. The mashup API has a method called clearAll() here which I should be able to use. However I am not sure how to implement this. The javascript file associated with my mashup is attached. an extract is below.
- I can see that the connection to the app is defined in the first block of code.
- When I reference the app object in the second block it does not work
- I am guessing the second function needs to somehow be embedded into the first block, is that correct?
- I dont quite understand the requireJS syntax, so I am a little lost on h
require( ["js/qlik"], function ( qlik ) {
qlik.setOnError( function ( error ) {
alert( error.message );
} );
//callbacks
//open app and get objects
var app = qlik.openApp("Thread Bare Clothing Sales.qvf", config);
$(".qvobject").each(function() {
var qvid = $(this).data("qvid");
app.getObject(this, qvid);
});
/*AUTOGEN START*/
/*AUTOGEN END*/
} );
function clearAll(){
alert("start")
app = qlik.currApp();
app.clearAll();
alert("end")
}
To anyone interested in the solution, one of my (very) esteemed colleagues suggested the following approach which worked perfectly.
Add this to your HTML
<div id="ClearAll"><button>Click me</button></div>
And then add to the JavaScript what it should do when clicked (below in Red)
var config = {
host: window.location.hostname,
prefix: "/",
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
} );
require( ["js/qlik"], function ( qlik ) {
qlik.setOnError( function ( error ) {
alert( error.message );
} );
//callbacks
//open app and get objects
var app = qlik.openApp("Barcelona Basecamp.qvf", config);
$(".qvobject").each(function() {
var qvid = $(this).data("qvid");
app.getObject(this, qvid);
});
$("#ClearAll").click(function() {
app.clearAll();
});
/*AUTOGEN START*/
/*AUTOGEN END*/
} )
To anyone interested in the solution, one of my (very) esteemed colleagues suggested the following approach which worked perfectly.
Add this to your HTML
<div id="ClearAll"><button>Click me</button></div>
And then add to the JavaScript what it should do when clicked (below in Red)
var config = {
host: window.location.hostname,
prefix: "/",
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
} );
require( ["js/qlik"], function ( qlik ) {
qlik.setOnError( function ( error ) {
alert( error.message );
} );
//callbacks
//open app and get objects
var app = qlik.openApp("Barcelona Basecamp.qvf", config);
$(".qvobject").each(function() {
var qvid = $(this).data("qvid");
app.getObject(this, qvid);
});
$("#ClearAll").click(function() {
app.clearAll();
});
/*AUTOGEN START*/
/*AUTOGEN END*/
} )
Here app.clearAll(); will clear all the selections from the app..can we just limit the clear all to only few object s (Highlighted below)
//get objects -- inserted here --
app.getObject('QV7','nkqrQX');
app.getObject('QV8','grjMbPe');
app.getObject('QV9','ExJF');
app.getObject('QV00','e10b830b-dd35-49ee-9e12-9624f9888677');
qlik.theme.apply('next-gen-theme');
//create cubes and lists -- inserted here --
$("#ClearAll").click(function() {
app.clearAll();
});
Hello everyone,
I have tried both solution and didn't work for me, i need to make a clear button in mashup to clear all selections