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

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

SelectedItemsChanged and page load

iguerra
16-Pearl

SelectedItemsChanged and page load

I have thingworx 9.6.5 cloud hosted.

 

On a mashup I have dropdown menu automatically populated and selected with the right value at page load.
Esample I have 3 options mode1 mode2 mode3, and at page load I populate the dropdown and select the last selection (ex mode3). 
I also use the SelectedItemsChanged event, in order to update the selected value with a service, whennever the dropdown is used.

The problem is that at page load, when it auto-select the last value (SelectedText input property of the widget), it launch the SelectedItemsChanged event and so it saves  that first selection as a change ... but this is not needed and cause some problems.

 

I know if I use an external SAVE BUTTON instead of the events I could solve .... but I would it saves changes directly when dropdown is changed.

Is there a best practise to to that ?

4 REPLIES 4

Hi @iguerra   can you try it? If the service is populating a dropdown widget, use the SelectedTextChanged event of the dropdown widget instead of the SelectedRowsChanged event of the service that populates the dropdown.

I was using the SelectedItemsChanged  , and not the SelectedRowsChanged  of the service populating the dropdown.

The SelectedTextChanged is firing anyway, probably because from "nothing" it selects a specific element, so it seems not to be a solution

There may be other solutions exist but what if you use an expression widget on the mashup with fire on first value to unchecked and then may be you can do your task. please try it out and let us know.

 

“Fire on First Value = false” on the gate expression only

  • Bind the dropdown’s SelectedText (or SelectedValue) into an Expression that outputs true when it changes.

  • Set Fire on First Value = false.

  • Use Validator -> Save.
    (Works if the initial bind is the only unwanted trigger.)

thank you

Hi @iguerra,

 

As @MA8731174 commented, you can use Expression function.

Expression function has Changed event, which will fire when an input parameter of the expression changes.

Bind the SelectedText of the List widget to the input parameter of the Expression.

And make sure to set Fire on First Value = false (which is the default setting) so that the first value passed to the expression's input parameter will not fire this Changed event.

TonyZhang_0-1758178662024.png

Best,

Tony
Announcements


Top Tags