Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

MVP
MVP

Paint function layout - no custom property for default value

Hi,

since v1.1 we do not get a property created in paint function layout object for the custom property if its value is left to default value. Only if we change the property value in accordeon the property gets created in layout object. Is this an issue or feature? If it's a feature, how we can access the default value then?

I have to add that I'm using a show condition for the property but doesn't matter if it's true or false..

- Ralf

10 Replies
Employee
Employee

Re: Paint function layout - no custom property for default value

Hi rbecher

thx for reporting this behavior, but unfortunately I do not fully get it ...

Can you ellaborate a bit more or post some code sample explaining what you want to see and what's happening, then I'll have a look into it.

Regards

Stefan

MVP
MVP

Re: Paint function layout - no custom property for default value

Hi Stefan,

cannot reproduce it. Must be a glitch (caching issue?) while extending custom properties in existing and used extension. However I attached a sample which shows how you can use "show" property to switch optional properties on another boolean property (would have been nice to find an example in the online help..).

Best regards,

Ralf

Employee
Employee

Re: Paint function layout - no custom property for default value

Hi Ralf,

agree that there should be a demo in the online help to show how it works.

But your example works perfect for me and code looks straighforward (as expected to be).

Regards

Stefan

MVP
MVP

Re: Paint function layout - no custom property for default value

Hi Stefan,

is it possible to nest properties in accordeon with the switch component like with the chart color settings?

- Ralf

Employee
Employee

Re: Paint function layout - no custom property for default value

Sorry, don't get it again ;-)

Do you mean this setting or something else, because this is working exactly the same way as your previously posted example:

Chart_ColorSettings.png

Best regards

Stefan

MVP
MVP

Re: Paint function layout - no custom property for default value

I would like to have it like in common settings where we have a switch and nested properties:

general_properties.jpg

In my example I have a tab/dropdown per property:

optional_properties.jpg

Employee
Employee

Re: Paint function layout - no custom property for default value

OK, will work on an example and publish it ...

yblake
Contributor II

Re: Paint function layout - no custom property for default value

Hi Ralph,

Thanks for sharing.

To ensure to get a value, you may set an initial default value in the initialProperties object, to be the default value when user first time drop the extension on the sheet :

initialProperties: {

  version: 1,

  optionalProp: false,

  qHyperCubeDef: {

I would also check for undefined properties, like this :

return (layout.optionalProp === undefined ? false : layout.optionalProp)

This will ensure to get a default value, i.e. if the user open an old app with a previous release of the extension that didn't had yet this property defined. But this may also solve your missing default value.

Regards

yblake
Contributor II

Re: Paint function layout - no custom property for default value

Hi,

To get this behaviour, you need to group by items lists :

definition: { type: "items", component: "accordion", items: { settings: { uses: "settings", type : "items", items : { firstGroup : { label : "Group 1", type : "items", items:{ testProp1: { ref: "testProp1", type: "string", label: "Property 1", defaultValue: "default1" } } }, secondGroup : { label : "Group 2", type : "items", items:{ 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 } } } } } } } },

Sorry I lost indentations, but it works :

custom properties.PNG

Regards

Community Browser