Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rbecher
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

Astrato.io Head of R&D
10 Replies
Stefan_Walther
Employee
Employee

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

rbecher
MVP
MVP
Author

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

Astrato.io Head of R&D
Stefan_Walther
Employee
Employee

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

rbecher
MVP
MVP
Author

Hi Stefan,

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

- Ralf

Astrato.io Head of R&D
Stefan_Walther
Employee
Employee

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

rbecher
MVP
MVP
Author

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

Astrato.io Head of R&D
Stefan_Walther
Employee
Employee

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

yblake
Partner - Creator II
Partner - Creator II

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
Partner - Creator II
Partner - Creator II

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