Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi,
I have written a service with output data shape MenuEntry. The output of this service is linked to a menu widget.
The menu data and the icons are loading, but the submenus are not loading. I refered the service writing method from the following link:https://support.ptc.com/help/thingworx/platform/r9/en/#page/ThingWorx/Help/Mashup_Builder/Widgets/MenuBarDefiningtheMenuBarItemsUsinganInfotable.html
Also, sharing my code for reference.
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "MenuEntry"
});
result.AddRow({
menuId: 'topMenu',
linkType: 'Menu',
});
result.AddRow({
linkDestination: 'Main_Utility_Dashboard',
isDefault: true,
parentMenuId: 'topMenu',
imageURL: 'Home_style_twaek_icon',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: '1',
linkType: 'Mashup',
title: 'Monitor'
});
result.AddRow({
isDefault: false,
parentMenuId: 'topMenu',
imageURL: 'dashboard_style_twaek_icon',
linkTarget: '', // (Popup, Mashup, New)
description: '',
menuId: 'idLogs',
linkType: 'Menu',
title: 'Utilities'
});
result.AddRow({
linkDestination: 'Chiller_HomePage',
isDefault: false,
parentMenuId: 'idLogs',
imageURL: 'TransparentIcon',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: 'idAllSites',
linkType: 'Mashup',
title: 'Chiller Page'
});
result.AddRow({
linkDestination: 'PTC.SCA.SCO.AssetMonitor.AssetList.AssetListContainerMashup_Lupin',
isDefault: false,
parentMenuId: 'topMenu',
imageURL: 'Asset_list',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: '3',
linkType: 'Mashup',
title: 'Asset List'
});
Here the 'Utilities' is showing in the main menu but is submenu 'Chiller Page' is not dropping down.
Thanks,
SriH
Solved! Go to Solution.
Hi,
As I understand from the details, you would like to load a Sub Menu from Menu Item 'Chiller Page'. To do this we would need to add 1 more row in this service code and set its parentMenuId to 'idAllSites' which is the menuId of 'Chiller Page'. And you would also need to change parameters of 'Chiller Page' as - remove linkDestination, make linkTarget blank instead of Self, set linkType to 'Menu' instead of Mashup
I have modified this code to add a Sub menu under 'Chiller Page', copying it below. Bind this to Menu widget, it should be able to load the Sub Menu under 'Chiller Page'
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "MenuEntry"
});
result.AddRow({
menuId: 'topMenu',
linkType: 'Menu',
});
result.AddRow({
linkDestination: 'Main_Utility_Dashboard',
isDefault: true,
parentMenuId: 'topMenu',
imageURL: 'Home_style_twaek_icon',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: '1',
linkType: 'Mashup',
title: 'Monitor'
});
result.AddRow({
isDefault: false,
parentMenuId: 'topMenu',
imageURL: 'dashboard_style_twaek_icon',
linkTarget: '', // (Popup, Mashup, New)
description: '',
menuId: 'idLogs',
linkType: 'Menu',
title: 'Utilities'
});
result.AddRow({
//linkDestination: 'Chiller_HomePage',
isDefault: false,
parentMenuId: 'idLogs',
imageURL: 'TransparentIcon',
linkTarget: '', // (Popup, Mashup, New)
description: '',
menuId: 'idAllSites',
linkType: 'Menu',
title: 'Chiller Page'
});
result.AddRow({
linkDestination: 'Chiller_HomePage_SubMenu',
isDefault: false,
parentMenuId: 'idAllSites',
imageURL: 'TransparentIcon',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: 'idAllSitesSubMenu',
linkType: 'Mashup',
title: 'Chiller Page SubMenu'
});
result.AddRow({
linkDestination: 'PTC.SCA.SCO.AssetMonitor.AssetList.AssetListContainerMashup_Lupin',
isDefault: false,
parentMenuId: 'topMenu',
imageURL: 'Asset_list',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: '3',
linkType: 'Mashup',
title: 'Asset List'
});
Let us know if it helps.
Hi,
As I understand from the details, you would like to load a Sub Menu from Menu Item 'Chiller Page'. To do this we would need to add 1 more row in this service code and set its parentMenuId to 'idAllSites' which is the menuId of 'Chiller Page'. And you would also need to change parameters of 'Chiller Page' as - remove linkDestination, make linkTarget blank instead of Self, set linkType to 'Menu' instead of Mashup
I have modified this code to add a Sub menu under 'Chiller Page', copying it below. Bind this to Menu widget, it should be able to load the Sub Menu under 'Chiller Page'
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "MenuEntry"
});
result.AddRow({
menuId: 'topMenu',
linkType: 'Menu',
});
result.AddRow({
linkDestination: 'Main_Utility_Dashboard',
isDefault: true,
parentMenuId: 'topMenu',
imageURL: 'Home_style_twaek_icon',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: '1',
linkType: 'Mashup',
title: 'Monitor'
});
result.AddRow({
isDefault: false,
parentMenuId: 'topMenu',
imageURL: 'dashboard_style_twaek_icon',
linkTarget: '', // (Popup, Mashup, New)
description: '',
menuId: 'idLogs',
linkType: 'Menu',
title: 'Utilities'
});
result.AddRow({
//linkDestination: 'Chiller_HomePage',
isDefault: false,
parentMenuId: 'idLogs',
imageURL: 'TransparentIcon',
linkTarget: '', // (Popup, Mashup, New)
description: '',
menuId: 'idAllSites',
linkType: 'Menu',
title: 'Chiller Page'
});
result.AddRow({
linkDestination: 'Chiller_HomePage_SubMenu',
isDefault: false,
parentMenuId: 'idAllSites',
imageURL: 'TransparentIcon',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: 'idAllSitesSubMenu',
linkType: 'Mashup',
title: 'Chiller Page SubMenu'
});
result.AddRow({
linkDestination: 'PTC.SCA.SCO.AssetMonitor.AssetList.AssetListContainerMashup_Lupin',
isDefault: false,
parentMenuId: 'topMenu',
imageURL: 'Asset_list',
linkTarget: 'Self', // (Popup, Mashup, New)
description: '',
menuId: '3',
linkType: 'Mashup',
title: 'Asset List'
});
Let us know if it helps.
Hi,
This code worked fine. But its creating menu(Chiller page submenu) under submenu(Chiller Page). Like,
- Utilities
-Chiller Page
-Chiller 1
-Chiller 2
But i needed,
-Utilities
-Chiller 1
-Chiller 2
I changed the code accordingly and its working fine as I needed. But the edited code is same as the one which was not working, not sure what was the issue before.
Thanks for the support,
SriH