cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Submenu not loading, when menu generated from a service and linked to Menu widget

SriH
8-Gravel

Submenu not loading, when menu generated from a service and linked to Menu widget

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

1 ACCEPTED SOLUTION

Accepted Solutions
ragrawal2
7-Bedrock
(To:SriH)

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.

View solution in original post

2 REPLIES 2
ragrawal2
7-Bedrock
(To:SriH)

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.

SriH
8-Gravel
(To:ragrawal2)

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

 

 

 

Top Tags