Mashup Builder > Data Services and Linking > Data Service Events
Data Service Events
Each data service has its own events, as follows:
ServiceInvokeCompleted — This event fires after a service call is done. An example use case might be to do a data update on the server, and when the update is complete, call another service to read back the data to another widget.
AllDataChanged — This event is fired when the data service returns a data set and the data set has been updated.
SelectedRowsChanged — This event is fired when a different data row is selected. For example, you may have a list of orders in a grid. When a specific order is clicked on by a user, the you may wish to update another data set on the page based on the selected order (maybe an order details query, for example). 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.