Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi all,
Our application relies heavily on custom extension widgets for showing large datasets in a card style layout.
We understand the mechanics of using properties and events, but are not able make the 'services' part work.
It would make development a lot easier if services could directly be triggered from mashup events. Currently we have a workaround to use change events on boolean property, but prefer to understand the 'service' method.
Documentation on this is currently quite limited:
Packaging a Web Component as a ThingWorx Widget - ThingWorx Web Component SDK - Polymer (ptc.com)
Any suggestions to guide us is in the right direction would be appreciated, thanks in advance!
Can't quite help you, but have you taken a look at for example the ootb 'Button' Widget to see how it does an action?
I haven't used the webcomponent SDK yet, but from my understanding, you should not trigger directly a server-side Service from the Widget runtime code. You should instead trigger an event, which, in turn, will trigger any other server-side Service or client-side Function via the bindings method.
For that to happen you don't need to modify the widget, just to make sure it emits the Events, like the ones in the screenshot below.
Technically you can define also widget Services, but those should do something in the scope of the client (eg: alter the widget DOM, set a widget property if needed, etc).
Below it's a snippet for the widget service "ClearSelectedRows" from the GitInfotableSelector widget:
This type of service can be called in the same fashion, via the binding mechanism, but you should not call services directly from here.