Data Service Events
Each data service has its own events, as follows:
ServiceInvokeCompleted—Triggers after a service call is done. For example, you can update data on a server by invoking a service. The ServiceInvokeCompleted event of the invoked service triggers when the data is updated. You can bind the event to another service and retrieve the updated data back to another widget.
AllDataChanged—Triggers when the data service returns a data set and the data set has been updated.
SelectedRowsChanged —Triggers when a different data row is selected. For example, you may have a list of orders in a grid. You can bind the event to a service that updates data for a widget that shows order details when a user clicks an order. If two widgets on the mashup page are bound to the same data, the selected data will be indicated in both widgets.
The concept of data services and binding is critical in creating ThingWorx mashups. The visualization widgets do not own the data set, the data services do. When you wish to bind an action or an update of another service, you typically do so through a data service event. Take the above example of two grids on a page. One grid displays the list of orders, the second grid displays a list of details for a specific order. When you select an order (select a row) in the first grid, you are actually selecting a row in the data service, and the call to update the order details is fired from the data service SelectedRowsChanged event, not from the grid itself. Other widgets, like the button, may have specific widget events. In the case of the button, it is the Clicked event, which is not specific to one data service.
You can call a data service from the server from any event. A single data service can be triggered from multiple events, depending on your needs. Many widgets also have events which can be used to trigger actions, such as data service execution. If a widget has one or more events, it will be visible if you click the arrow at the top left of the widget in the Mashup Builder design time. If there is an event, it can be dragged to any data service to execute the service call.
Was this helpful?