Can not get the sent Options of the embedded widget

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 04:17 AM
Hi,
I created a new widget with an embedded widget. I'm trying to sent params from the new widget to the embedded widget.
1) Parent widget:
HTML:
<div class="embedded-widget">
<sp-widget widget="c.processflow"></sp-widget>
</div>
Client controller:
spUtil.get("process-flow", {table:"change_request"}).then(function(response) {
c.processflow= response;
});
2) Embedded widget:
Client controller:
console.log("Table: "+c.options.table);
Server script:
console.log("table: "+input.options.table +" - "+options.table);
All of these results for "console.log" are undefined.
Cheers,
Serkan
- 3,386 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2017 06:30 AM
Hi Serkan
Not the best solution but you can try to do something like this.
spUtil.get("process-flow").then(function(response) {
c.options.sys_id = "test sys id";
c.processflow= response;
});
I didn't find anything better and at least works with the cool clock widget where you can set at least 3 options params
Cheers
R0bo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2017 07:57 AM
If the data that is needed can be accessed via the html markup then the best and easiest thing I think would be to use the widget directive:
<div ng-repeat="item in c.some_items">
<widget id="[widget id here]" options="item"></widget>
</div>
Note: this widget does the same thing as the <sp-widget></sp-widget> directive except it doesn't require making a variable in the controller and it's not prepended with "sp-". Just use the widget id of the desired widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2020 10:07 AM
I had the same issue. I was unable to send values to embedded widget from parent's client controller. So, I used the options in html directly. Here is my working example:
Parent Widget:
HTML:
<div>
<widget id='embedded-widget' options='{"name" : "smc"}'> </widget>
</div>
Nothing in client controller and server script
Embedded Widget:
HTML:
<div>
<div> {{name}} </div>
</div>
Client Controller:
function($scope) {
var c = this;
$scope.name = c.options.name;
}