Making RPC calls to the server
Sooner or later, your widget will need to look up some data from the server. In this recipe, we will add a tooltip on the color pill. When the user hovers their cursor over the color pill element, the tooltip will show the number of books related to that color. We will make an RPC call to the server to fetch a book count of the data associated with that particular color.
Getting ready
For this recipe, we will be using the my_library
module from the previous recipe.
How to do it...
Perform the following steps to make an RPC call to the server and display the result in a tooltip:
- Add the
willStart
method and setcolorGroupData
in the RPC call:Â Â willStart: function () { Â Â Â Â Â Â Â Â var self = this; Â Â Â Â Â Â Â Â this.colorGroupData = {}; Â Â Â Â Â Â Â Â var colorDataPromise = this._rpc({ Â Â Â Â Â Â ...