1

I have a entity admin table that navigates to a dashboard state for a specific row on row click. I want to have a default dashboard state and on row click populate the dashboard with the data of the device. This needs to be repeated for multiple devices.

How would I go about doing this?

  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Nov 09 '21 at 20:55

1 Answers1

1

You need to set the state entity. In your row click action, if you are using a simple logic one, be sure to tick the "Set entity from widget" checkbox.

Then in the target dashboard state, you need to include an entity alias as below. State Entity Alias

Text desc of image:
Alias Name: state entity
Filter Type: Entity from dashboard state
Resolve as multiple: False
Others: None (leave empty)

This will mean that all widgets using this alias will dynamically change based on the current "state entity". You can change the state entity multiple ways, but I recommend to minimise the places that you do this. It can get complicated fast.

If you are not using a simple widget action, and instead using a custom widget action, you will need to use the following code to set the state entity.

function updateDashboardState(stateId, label) {
    var params = {
        entityId: entityId,
        entityName: entityName,
        entityLabel: label, // Optional
    };
    // Line below opens new state
    widgetContext.stateController.openState(stateId,
        params, false);
    // Line below updates state
    // widgetContext.stateController.updateState(stateId,
        params, false);
}
JacksonB
  • 349
  • 1
  • 5
  • This works perfectly thanks.. now if I want to add more colums to the entity admin table itself how would I do it – NotSOSMartie Nov 09 '21 at 14:50
  • Add more datasources. Here is a link to the Thingsboard youtube channel, you should watch their videos. They cover many of the basics https://www.youtube.com/watch?v=0io1YnQjIwA – JacksonB Nov 09 '21 at 22:06