Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Partner
Partner

Initializing custom color picker object

I'm adding the ability to select a custom color for each measure in my extension. 

So far everything is working.. I see the color picker, I can select a color and that color is reported in the hypercube.

The problem I'm having is setting the initial value in the picker itself, it always displays as blank. Here's my code:

					measures: {
						uses: "measures",
						min: 1,
						max: 6,
						type:"items",
						items: {
							VisualType: {
								type: "string",
								component:"dropdown",
								label: "Visual Type",
								ref: "qDef.visualType",
								options: [{
									value: "BAR",
									label: "Bar"
								},{
									value: "LINE",
									label: "Line"
								},{
									value: "POINT",
									label: "Point"
								}],
								defaultValue: "BAR"
							},
							VisualColor: {
								type:"object",
								component:"color-picker",
								label:"Visual Color",
								ref: "qDef.visualColor",
								defaultValue: {
									color: "ff5866",
									index: "-1"
								}
							}
						},
						paint: function($element,layout) {
							$element.css("background-color",layout.qDef.visualColor);
						}
					},

Thanks in advance for any help,

Steve

1 Reply
Partner
Partner

Re: Initializing custom color picker object

I think the problem is that the example I took my code from specifies a default value of "ff5866" when in fact it should have been "#ff5866".