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

Navigation only if condition is TRUE

Ivens
5-Regular Member

Navigation only if condition is TRUE

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Ivens
5-Regular Member
(To: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 = "";

View solution in original post

10 REPLIES 10

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.

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

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).

Who uses Navigate widgets anymore, anyway? 8-)

Well I'm on 7.3.20 migrating to 8.4.9, which it's the replacement for Navigation widget?

There are Navigation Functions, which live next to Expressions and Validators, but I don't remember if they were introduced in 8.4 or 8.5. With them you need to replace your Navigators with Buttons, which trigger those functions. But this is one of the easiest things about migrating from 7.3 to 8.5, if you ever considered that.

 

/ Constantine

Navigation expression it's a thingy of 8.5. We don't plan for now for 8.5, just 8.4, almost everything works now on the UI side...

 

Carles

Ivens
5-Regular Member
(To:Constantine)

Hi @Constantine ,

    Here you have my initial Mashup without any records on the grid because the user didn't select the filters yet.

Ivens_0-1587993328537.png

    On this stage I need to avoid open the popup when clicking the Delete Navigation, because there is nothing to delete yet. Only after the user populate the grid and select a record the Delete Navigation should open the popup. I got the solution using the hidden navigator, it works! I was just wondering if I this is the best way (in fact I have a trauma with this hidden components thanks to Delphi hahahah)

Ivens
5-Regular Member
(To: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 = "";

Thanks @Ivens,

 

I'm glad that it works for you with selecting the mashup name. My approach was more around hiding or disabling the Delete button via a validator.

 

As for your traumatic experience -- I can confirm that hidden navigators are the way to go and a pretty common design (anti?)pattern in ThingWorx. In 8.5 you can retire them and use Navigation functions instead -- it takes some pain away and your mashup start to look more like Qt or JavaFX than Delphi -- you still have business logic in presentation layer, but at least you don't see it on the form anymore ))

 

/ Constantine

Announcements