You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/code-based-custom-actions.adoc
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,9 @@ Custom Actions can be embedded through the Visual Embed SDK in the following two
69
69
70
70
=== Code based custom action for Liveboards
71
71
72
+
[NOTE]
73
+
Code based custom action for Liveboards do not return data for visualizations in their callback. To get data from a Liveboard object and its visualizations use the `POST /api/rest/2.0/metadata/liveboard/data` API endpoint.
74
+
72
75
The custom action is applied to all Liveboards.
73
76
74
77
[source,javascript]
@@ -206,6 +209,8 @@ const customActions = [{
206
209
}, ];
207
210
----
208
211
212
+
213
+
////
209
214
When the answerId parameter is provided, the system displays custom actions only on the visualization(s) that use the specified underlying answerId.
210
215
211
216
In this example, consider a Liveboard (lb1) with three visualizations: viz1 (based on ans1), viz2 (based on ans2), and viz3 (based on ans3).
@@ -229,6 +234,8 @@ const customActions = [{
229
234
}, ];
230
235
231
236
----
237
+
////
238
+
232
239
233
240
When `modelIds` is passed in the `dataModelIds`, then the custom action is show for all visualization which are using the columns of the specified model.
234
241
@@ -432,6 +439,9 @@ In this example, for a user who is part of org1 and grp1,
432
439
433
440
* The custom action will also be shown in any Liveboard where these answers have been pinned.
434
441
442
+
[NOTE]
443
+
`modelColumnNames` are not currently supported for code based custom action for Spotter.
444
+
435
445
[source,javascript]
436
446
----
437
447
const customActions = [{
@@ -445,4 +455,21 @@ const customActions = [{
445
455
groupId: ['grp1'],
446
456
orgId: ['org1']
447
457
}, ];
448
-
----
458
+
----
459
+
460
+
461
+
=== Add callback to a code based custom action
462
+
463
+
To add an event handler to listen to the callback event and trigger a data payload as a response when a user clicks on the code based custom action, use the Visual Embed SDK's .on method with EmbedEvent.CustomAction.
464
+
465
+
[source,javascript]
466
+
----
467
+
embed.on(EmbedEvent.CustomAction, (payload) => {
468
+
if (payload.data.id === 'your-custom-action-id') {
0 commit comments