Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation to another dashboard from custom action doesn't work in mobile app #190

Open
irrtc-admin opened this issue Oct 31, 2024 · 1 comment

Comments

@irrtc-admin
Copy link

We have an entity table in a dashboard where a custom action is invoked on row click. In this custom action, we are navigation the user to another dashboard using dashboard id. This action is successful in the browser Web app and the new dashboard opens in the same window. However, this action doesn't work from the iOS version of the mobile app. We see the error shown in the screenshot below:

Simulator Screenshot - iPhone 16 Pro Max - 2024-10-30 at 17 13 23

This is the custom action code:

let target_dashboard_id = "Admin Dashboard ID" in additionalParams.entity ? additionalParams.entity["Admin Dashboard ID"] : null;

if (target_dashboard_id !== null ) {
let stateObject = {
id: "customer_details_view",
params: {
entityId: entityId,
entityName: entityName
}
};

let state = objToBase64URI([stateObject]);
let url = "/dashboards/" + target_dashboard_id + "?state=" + state + "";
widgetContext.router.navigateByUrl(url);

}

function objToBase64URI(obj) {
return encodeURIComponent(objToBase64(obj));
}

function objToBase64(obj) {
const json = JSON.stringify(obj);
return btoa(encodeURIComponent(json).replace(
/%([0-9A-F]{2})/g,
function toSolidBytes(match, p1) {
return String.fromCharCode(Number('0x' +
p1));
}));
}

Has anyone encountered this and/or know how to solve it? I am assuming it is something to do with the url, but I am not sure what. Thanks in advance.

@ybeshkarov
Copy link
Contributor

Hey,

I've created branch for you https://github.com/thingsboard/flutter_thingsboard_pe_app/tree/dashboard-navigation.
Please check if it's what you looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants