How to change Widget elements from variable change

I’m looking for a way to be able to change various elements of a Widget, such as Topic, Variable Alias and others, from any changes to a variable in a Bucket from data received from a Device. This would be used to dynamically customize the Dashboard Widgets display based on configuration data received from a Device.

Hi @dlkarm123456,
I suggest you use the custom widget.
Please, take a look at the documentation below:
Custom Widget Overview

That’s not very practical, as I would have to re-invent each of the Widgets I’m using to add the desired capability!
As a matter-of-fact, I tried to duplicate the Custom Widget tutorial (custom-widget-iframe/279), but could not get it to work.

I am currently exploring the use of the JS SDK API in Analysis scripts to do what I want with some success so far.

Hi @dlkarm123456,

In this case, you can use the API to edit the widget properties:
Node.js | Account | Widgets | .edit
You can do it using an Analysis based on the data that you got.

By the way, could you inform us which part of the Custom Widget Overview tutorial you got lost?

The part of the tutorial that I could not get to work was sending the data to the Dynamic Table when the “Send data” button was pressed. What was not detailed in the tutorial was the settings for the Dynamic Table used with the custom widget. I set the Dynamic Table to use the “my_variable2” variable that was supposed to be sent by the sendData() function in the javascript code in the tutorial.
However, no error occurs when sending the data from the custom widget and the Dynamic Table does not get the sent data. Also, in looking at the Device Bucket’s variable tab, I do not see the variable “my_variable2” there after sending from the custom widget. I did confirm the sendData() function was being called with a “console.log()” statement in the function with the Web Console in my Firefox browser.
I also confirmed that the Dynamic Table does show the “my_variable2” variable data by using the device Emulator to send test data to “my_variable2” and that works as expected, and after such, the variable “my_variable2” was now shown in the Bucket.
I don’t know how to actually confirm the sendData() function was actually sending the data or not. I tried to use Live Inspector and it did not show any data being received from the custom widget, but I did see the test data sent by the Emulator.

So, in summary, the tutorial’s custom widget would not send data to show up in the Dynamic Table.

1 Like

Hi @dlkarm123456,

Thanks for your feedback, we will improve the tutorial. :v: