edit-icon download-icon

DataV callback ID

Last Updated: Jul 11, 2018

In a DataV project, select a widget, and then click the Interaction tab at the upper-right corner to configure an interaction for the widget.

image

What is a callback ID?

The callback ID in DataV refers to the parameter a widget sends to other widgets when it responds to your actions, or when an update is automatically triggered. The parameter is a dynamic variable used for data query in the target widgets.

For example, when you click a province name on a map widget, the group bar widget uses the selected province name as a parameter to query statistics on cities of the province. Or, when the time value of the timeline widget changes, the slideshow list widget uses the callback ID as a parameter to acquire new data.

image

In the current version of DataV, you can configure a callback ID from both the Interaction and Style tabs.

image

image

Configuration

The following example uses a Ticker Board widget.

  1. Select Enable at the upper-right corner.

    The widget provides a parameter value (the Field column in the following screenshot corresponds to the field in the data source) to other widgets when the digits change.
    The system automatically creates a variable of the same name value (Bind to a Variable column in the following screenshot ) directed to the parameter.

    image

  2. Change the variable name listed under the Bind to a Variable column. As shown in the following example, value is changed to income, so that other widgets can use the variable named income to retrieve this parameter.

    With this feature, you can configure different variable names for different widgets, so as to differentiate used parameters.

    image

Advanced settings

  • Set custom fields

    In addition to required fields, you also can configure custom fields at the data source section. In the following example, a custom field id is created for the digit flipper, and the value is set to “123”.

    image

    Return to the tab where you configured the Interaction feature, click the Create a New Field and enter a variable name under the Bind to a Variable column.

    Note: Only when both the Field and the Bind to a Variable fields are filled out, can this variable take effect.

    image

  • Set the default value for the callback ID

    Set the default value of the callback ID by configuring the request parameters in the URL, as shown in the following example:

    1. http://datav.aliyun.com/screen/000000?myid=123
    2. **Note:** "000000" refers to the screen ID

    When accessing data through this URL, the value of the callback ID myid is already set to “123”.

    Use the ampersand sign & to join multiple callback IDs, as shown in the following example.

    1. http://datav.aliyun.com/screen/000000?myid=123&income=1000
    2. **Note:** "000000" refers to the screen ID

    The default values for both callback IDs, myid and income are set.

Usage

The use of the callback ID is to allow certain widgets to collectively respond to data updates by means of shared parameters. You can use :Variable name (such as, “:abc”) in the data source, as shown in the following example.

  • SQL:

    1. select :name as value
    2. select A from table where year = :name
  • API:

    1. http://api.test?income=:income&id=:myid

Auto-complete feature

A callback parameter auto-complete feature is available in DataV.
When configuring the data source, if you type :, the editor prompts all variable names that were configured in the current project. Use the up and down arrow buttons to browse the variables and press enter to select.

The callback parameter auto-complete feature helps you easily view any previously configured variables so that you can better navigate your widgets and data.

image

Thank you! We've received your feedback.