Last active
September 15, 2015 18:19
-
-
Save ralfbecher/8d953dae0d746d6265df to your computer and use it in GitHub Desktop.
Qlik Sense example extension with switchable user custom properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @owner Ralf Becher, irregular.bi | |
*/ | |
define( ["jquery", "qlik"], | |
function ($, qlik) { | |
return { | |
//property panel | |
definition: { | |
type: "items", | |
component: "accordion", | |
items: { | |
settings: { | |
uses: "settings", | |
items: { | |
testProp1: { | |
ref: "testProp1", | |
type: "string", | |
label: "Property 1", | |
defaultValue: "default1" | |
}, | |
optionalProp: { | |
ref: "optionalProp", | |
type: "boolean", | |
label: "Optional Property", | |
defaultValue: false | |
}, | |
testProp2: { | |
ref: "testProp2", | |
type: "string", | |
label: "Property 2", | |
defaultValue: "default2", | |
show: function(layout) { return layout.optionalProp } | |
}, | |
testProp3: { | |
ref: "testProp3", | |
type: "string", | |
label: "Property 3", | |
defaultValue: "default3", | |
show: function(layout) { return layout.optionalProp } | |
} | |
} | |
} | |
} | |
}, | |
snapshot: { | |
canTakeSnapshot: true | |
}, | |
paint: function ($element, layout) { | |
console.log(layout); | |
var output = layout; | |
delete output.qInfo; | |
delete output.qSelectionInfo; | |
delete output.metadata; | |
delete output.showTitles; | |
delete output.title; | |
delete output.subtitle; | |
delete output.footnote; | |
delete output.visualization; | |
$element.html( "Custom Properties Test:<br>"+JSON.stringify(output, null, "<br>") ); | |
} | |
}; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment