Programmatic creation of LineWidgets with Captions (SDK v1.1)

  • 11 February 2022
  • 3 replies
  • 58 views

Userlevel 1

Hey there

 

When trying to create LineWidgets with captions, the latter don’t show up anywhere.

Maybe I’m understanding these captions wrong though..

 

My data to create the widget from is for example:

```

"type":"LINE",

"startWidgetId":"3458764518694665547",

"endWidgetId":"3458764518694665157",

"style":{"lineType":2,"lineStyle":1,"lineEndStyle":6,"lineStartStyle":0,"lineThickness":2,"lineColor":"#ff1500"},

"captions":[{"text":"depends"}],

"capabilities":{"editable":false},

"metadata":{"{id}":{"id":{id}}}}

```

 

Creating a widget based on this data works, but the result lacks a caption.

 

What i’d expect/want is:

 

 

Am I using the “captions” property correctly?


3 replies

Userlevel 7
Badge +5

@Andrin Urech

yeah - that’s unfortunately not the case here. 

In my experience… 

I understand line widget captions being “read only” to mean: the property CAN be written by the system through a normal user interaction on the board UI  - but can’t be written at all programmatically through the API/SDK, only read. 

widget.type is also read-only and it works as you’ve described I believe, where it can be defined and written at creation, but cannot be updated. Line captions cannot be programmatically written ever.   

Userlevel 1

Hey, @Max Harper 

Yes, the SDK Reference for version 1.1 mentions the property as “readOnly”. But usually this means that after initialization, one can’t change it (in case of an array, of course you can still change its entries, just not the pointer to the root).

I would therefore expect that when I create the entire ILineWidget-object with captions defined and pass it to the SDK for creation, this read only constraint wouldn’t be violated.

Is that a wrong assumption then?

 

And in that case, the only workaround would be to push entries into the captions array post-creation, right?

Userlevel 7
Badge +5

@Andrin Urech 

I’m pretty sure Line captions are read only. This applies to V1 sdk and lines are yet to be implemented in v2- 

Reply