Skip to main content
12-Amethyst
April 27, 2020
Solved

Navigation only if condition is TRUE

  • April 27, 2020
  • 10 replies
  • 3971 views

Hi,

    What is the best way to open a popup window only if a condition is true? I would like to open a popup only if a record is selected from a grid. My initial shot was keep the MashupName parameter empty on the Navigator and setup if the condition on the Validator is True, but I don't know how to create a MashupName object to be returned from the Validator.

Best answer by Ivens

    I've found a solution using an Expression, I sent one of the grid parameters to the expression and it the value is not NULL I return the MashupName (String), then I just bind the expression output to the MashupName property of my navigator and it's done.

    Below you have the code that I use on the expression, LineId is parameter that I receive from the grid to validate if the user selected something or not.

 

if( LineId !== undefined || LineId !== NULL)
)
result = "Neutron.BC.DowntimeDelete_MU";
else
result = "";

10 replies

1-Visitor
April 27, 2020

Just add a Validator expression, which triggers the popup when true. Of course, you will need to add a standard button which triggers the validator expression, and hidden the navigator widget button.

18-Opal
April 27, 2020

Hello @Ivens,

 

In addition to what Carles wrote, just wanted to say that usually there exist somewhat more user-friendly alternatives to prevent navigation, e.g. disabling the Navigate button (also using Validator); auto-selecting the first row in the grid; navigating on double-click in the grid (then a row is selected automatically), etc. If you show a screenshot of your mashup, we might be able to find a more elegant solution than just not navigating.

 

Regards,
Constantine

1-Visitor
April 27, 2020

Yup Constantine for sure it's better, but must be done with the Button widget not with the Navigate widget (which hasn't a Disabled option).

18-Opal
April 27, 2020

Who uses Navigate widgets anymore, anyway? 8-)