Page 1 of 1

How to reference a form in a module

PostPosted: Fri Jan 21, 2022 5:51 pm
by dlclark
Exploring NGClient - MODULES:

When creating a MENU item in svyNavigationUX: how do you reference a FORM in another MODULE.

For example: I load our Magazine solution as a MODULE of cloudSampleSolution and try to create a menu item in MainNavMenu.js ?

I have tried using scopes.<module_solution_name>.forms.<form_name.frm>


Appreciate the guidance....

Daryl

Re: How to reference a form in a module

PostPosted: Mon Jan 24, 2022 9:57 am
by paronne
Hi Daryl,

a couple of pointers which may help you.
The mainNavMenu form of the cloudSampleSolution can reference any form on any of it's submodules ( including your Magazine solution in your setup ).
To add menu items, you can amend the method loadMenuItems() in mainNavMenu.js.
You can add menu entries such as:

Code: Select all
// Magazine
menuItem = new Object();
menuItem.id = "nameOfYourMagazineForm";
menuItem.text = "MAGAZINE"
menuItems.push(menuItem);


Using the name of the form as id of menuItem will allow you to access the form when the Menu Item is clicked.

If you need to access the form programmatically instead you can use the navigation API:

Code: Select all
var item = new scopes.svyNavigation.NavigationItem(formName);
scopes.svyNavigation.open(item);


See wiki of svyNavigation Module:
https://github.com/Servoy/svyNavigation ... t-the-menu
https://github.com/Servoy/svyNavigation ... gation-api

Regards,
Paolo