How to reference a form in a module

Questions, tips and tricks and techniques for scripting in Servoy

How to reference a form in a module

Postby dlclark » Fri Jan 21, 2022 5:51 pm

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
dlclark
 
Posts: 38
Joined: Sat Jan 08, 2022 5:39 pm

Re: How to reference a form in a module

Postby paronne » Mon Jan 24, 2022 9:57 am

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
paronne
 
Posts: 202
Joined: Fri Nov 02, 2012 3:21 pm


Return to Methods

Who is online

Users browsing this forum: No registered users and 5 guests

cron